added a TODO entry about additional image/file info.

2001-08-11  Michael Natterer  <mitch@gimp.org>

	* TODO.xml: added a TODO entry about additional image/file info.

	* app/file-save.c: #include "core/gimpdocuments.h"

	* app/core/gimpcontainer.[ch]: made virtual functions out of some
	signals.

	* app/core/*.[ch]: more GObject stuff: ported all
	gimp_foo_get_type() functions and replaced almost all "destroy"
	implementations with either "finalize" or "dispose" functions.
This commit is contained in:
Michael Natterer 2001-08-11 14:39:19 +00:00 committed by Michael Natterer
parent fec97c4919
commit 357f463d59
69 changed files with 2166 additions and 1402 deletions

View File

@ -1,3 +1,16 @@
2001-08-11 Michael Natterer <mitch@gimp.org>
* TODO.xml: added a TODO entry about additional image/file info.
* app/file-save.c: #include "core/gimpdocuments.h"
* app/core/gimpcontainer.[ch]: made virtual functions out of some
signals.
* app/core/*.[ch]: more GObject stuff: ported all
gimp_foo_get_type() functions and replaced almost all "destroy"
implementations with either "finalize" or "dispose" functions.
2001-08-11 Seth Burgess <sjburges@gimp.org>
* plug-ins/common/colortoalpha.c: set nparams != 4 for
@ -30,8 +43,13 @@
* app/widgets/gimpdnd.[ch]: make it DND-able.
<<<<<<< ChangeLog
* app/widgets/gimppreview.c: fix preview rendering correctly this
time.
=======
* app/widgets/gimppreview.c: fix preview rendering correctly this
time.
>>>>>>> 1.3709
2001-08-10 Sven Neumann <sven@gimp.org>

View File

@ -88,6 +88,24 @@
</contact>
</entry>
<entry size="small" difficulty="easy" status="0%" target="1.4">
<title>Image/File Information</title>
<description>
<p>
Additionally to the image comment, GIMP should save & manage
File Information like "description", "keywords",
"copyright", "year", etc.
</p>
<p>
File Info data sets should be saveable separately and
importable from standard formats.
</p>
</description>
<contact>
GIMP Developer List &lt;gimp-developer@xcf.berkeley.edu&gt;
</contact>
</entry>
</section> <!-- General -->
<section>

View File

@ -67,26 +67,29 @@ static void gimp_context_destroy_callback (GimpContext *context,
static GimpObjectClass *parent_class = NULL;
GtkType
GType
gimp_get_type (void)
{
static GtkType object_type = 0;
static GType object_type = 0;
if (! object_type)
{
GtkTypeInfo object_info =
static const GTypeInfo object_info =
{
"Gimp",
sizeof (Gimp),
sizeof (GimpClass),
(GtkClassInitFunc) gimp_class_init,
(GtkObjectInitFunc) gimp_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (Gimp),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_init,
};
object_type = gtk_type_unique (GIMP_TYPE_OBJECT, &object_info);
object_type = g_type_register_static (GIMP_TYPE_OBJECT,
"Gimp",
&object_info, 0);
}
return object_type;
@ -170,10 +173,14 @@ gimp_destroy (GtkObject *object)
gimp = GIMP (object);
gimp_set_current_context (gimp, NULL);
if (gimp->current_context)
gimp_set_current_context (gimp, NULL);
gimp_set_user_context (gimp, NULL);
gimp_set_default_context (gimp, NULL);
if (gimp->user_context)
gimp_set_user_context (gimp, NULL);
if (gimp->default_context)
gimp_set_default_context (gimp, NULL);
if (gimp->standard_context)
{
@ -181,9 +188,11 @@ gimp_destroy (GtkObject *object)
gimp->standard_context = NULL;
}
gimp_image_new_exit (gimp);
if (gimp->image_base_type_names)
gimp_image_new_exit (gimp);
gimp_documents_exit (gimp);
if (gimp->documents)
gimp_documents_exit (gimp);
if (gimp->tool_info_list)
{
@ -191,7 +200,8 @@ gimp_destroy (GtkObject *object)
gimp->tool_info_list = NULL;
}
procedural_db_free (gimp);
if (gimp->procedural_ht)
procedural_db_free (gimp);
if (gimp->brush_factory)
{
@ -251,9 +261,11 @@ gimp_destroy (GtkObject *object)
gimp->images = NULL;
}
gimp_parasites_exit (gimp);
if (gimp->parasites)
gimp_parasites_exit (gimp);
gimp_units_exit (gimp);
if (gimp->user_units)
gimp_units_exit (gimp);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);

View File

@ -107,7 +107,8 @@ struct _GimpClass
};
GtkType gimp_get_type (void);
GType gimp_get_type (void);
Gimp * gimp_new (void);
void gimp_initialize (Gimp *gimp);

View File

@ -67,7 +67,9 @@ enum
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_destroy (GtkObject *object);
static void gimp_brush_finalize (GObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -85,37 +87,41 @@ static GimpDataClass *parent_class = NULL;
GType
gimp_brush_get_type (void)
{
static GType type = 0;
static GType brush_type = 0;
if (! type)
if (! brush_type)
{
static const GtkTypeInfo info =
static const GTypeInfo brush_info =
{
"GimpBrush",
sizeof (GimpBrush),
sizeof (GimpBrushClass),
(GtkClassInitFunc) gimp_brush_class_init,
(GtkObjectInitFunc) gimp_brush_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_init,
};
type = gtk_type_unique (GIMP_TYPE_DATA, &info);
brush_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpBrush",
&brush_info, 0);
}
return type;
return brush_type;
}
static void
gimp_brush_class_init (GimpBrushClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -128,7 +134,7 @@ gimp_brush_class_init (GimpBrushClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_brush_destroy;
object_class->finalize = gimp_brush_finalize;
viewable_class->get_new_preview = gimp_brush_get_new_preview;
@ -141,31 +147,36 @@ gimp_brush_class_init (GimpBrushClass *klass)
static void
gimp_brush_init (GimpBrush *brush)
{
brush->mask = NULL;
brush->pixmap = NULL;
brush->mask = NULL;
brush->pixmap = NULL;
brush->spacing = 20;
brush->x_axis.x = 15.0;
brush->x_axis.y = 0.0;
brush->y_axis.x = 0.0;
brush->y_axis.y = 15.0;
brush->spacing = 20;
brush->x_axis.x = 15.0;
brush->x_axis.y = 0.0;
brush->y_axis.x = 0.0;
brush->y_axis.y = 15.0;
}
static void
gimp_brush_destroy (GtkObject *object)
gimp_brush_finalize (GObject *object)
{
GimpBrush *brush;
brush = GIMP_BRUSH (object);
if (brush->mask)
temp_buf_free (brush->mask);
{
temp_buf_free (brush->mask);
brush->mask = NULL;
}
if (brush->pixmap)
temp_buf_free (brush->pixmap);
{
temp_buf_free (brush->pixmap);
brush->pixmap = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -67,7 +67,9 @@ enum
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_destroy (GtkObject *object);
static void gimp_brush_finalize (GObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -85,37 +87,41 @@ static GimpDataClass *parent_class = NULL;
GType
gimp_brush_get_type (void)
{
static GType type = 0;
static GType brush_type = 0;
if (! type)
if (! brush_type)
{
static const GtkTypeInfo info =
static const GTypeInfo brush_info =
{
"GimpBrush",
sizeof (GimpBrush),
sizeof (GimpBrushClass),
(GtkClassInitFunc) gimp_brush_class_init,
(GtkObjectInitFunc) gimp_brush_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_init,
};
type = gtk_type_unique (GIMP_TYPE_DATA, &info);
brush_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpBrush",
&brush_info, 0);
}
return type;
return brush_type;
}
static void
gimp_brush_class_init (GimpBrushClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -128,7 +134,7 @@ gimp_brush_class_init (GimpBrushClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_brush_destroy;
object_class->finalize = gimp_brush_finalize;
viewable_class->get_new_preview = gimp_brush_get_new_preview;
@ -141,31 +147,36 @@ gimp_brush_class_init (GimpBrushClass *klass)
static void
gimp_brush_init (GimpBrush *brush)
{
brush->mask = NULL;
brush->pixmap = NULL;
brush->mask = NULL;
brush->pixmap = NULL;
brush->spacing = 20;
brush->x_axis.x = 15.0;
brush->x_axis.y = 0.0;
brush->y_axis.x = 0.0;
brush->y_axis.y = 15.0;
brush->spacing = 20;
brush->x_axis.x = 15.0;
brush->x_axis.y = 0.0;
brush->y_axis.x = 0.0;
brush->y_axis.y = 15.0;
}
static void
gimp_brush_destroy (GtkObject *object)
gimp_brush_finalize (GObject *object)
{
GimpBrush *brush;
brush = GIMP_BRUSH (object);
if (brush->mask)
temp_buf_free (brush->mask);
{
temp_buf_free (brush->mask);
brush->mask = NULL;
}
if (brush->pixmap)
temp_buf_free (brush->pixmap);
{
temp_buf_free (brush->pixmap);
brush->pixmap = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -50,7 +50,6 @@
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
@ -60,44 +59,43 @@ static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
GtkType
GType
gimp_brush_generated_get_type (void)
{
static GtkType type = 0;
static GType brush_type = 0;
if (!type)
if (! brush_type)
{
GtkTypeInfo info =
static const GTypeInfo brush_info =
{
"GimpBrushGenerated",
sizeof (GimpBrushGeneratedClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_generated_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrushGenerated),
sizeof (GimpBrushGeneratedClass),
(GtkClassInitFunc) gimp_brush_generated_class_init,
(GtkObjectInitFunc) gimp_brush_generated_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_generated_init,
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushGenerated",
&brush_info, 0);
}
return type;
return brush_type;
}
static void
gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
{
GtkObjectClass *object_class;
GimpDataClass *data_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
data_class = (GimpDataClass *) klass;
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
@ -114,13 +112,6 @@ gimp_brush_generated_init (GimpBrushGenerated *brush)
brush->freeze = 0;
}
static void
gimp_brush_generated_destroy (GtkObject *object)
{
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_brush_generated_save (GimpData *data)
{

View File

@ -50,7 +50,6 @@
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
@ -60,44 +59,43 @@ static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
GtkType
GType
gimp_brush_generated_get_type (void)
{
static GtkType type = 0;
static GType brush_type = 0;
if (!type)
if (! brush_type)
{
GtkTypeInfo info =
static const GTypeInfo brush_info =
{
"GimpBrushGenerated",
sizeof (GimpBrushGeneratedClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_generated_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrushGenerated),
sizeof (GimpBrushGeneratedClass),
(GtkClassInitFunc) gimp_brush_generated_class_init,
(GtkObjectInitFunc) gimp_brush_generated_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_generated_init,
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushGenerated",
&brush_info, 0);
}
return type;
return brush_type;
}
static void
gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
{
GtkObjectClass *object_class;
GimpDataClass *data_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
data_class = (GimpDataClass *) klass;
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
@ -114,13 +112,6 @@ gimp_brush_generated_init (GimpBrushGenerated *brush)
brush->freeze = 0;
}
static void
gimp_brush_generated_destroy (GtkObject *object)
{
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_brush_generated_save (GimpData *data)
{

View File

@ -50,7 +50,6 @@
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
@ -60,44 +59,43 @@ static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
GtkType
GType
gimp_brush_generated_get_type (void)
{
static GtkType type = 0;
static GType brush_type = 0;
if (!type)
if (! brush_type)
{
GtkTypeInfo info =
static const GTypeInfo brush_info =
{
"GimpBrushGenerated",
sizeof (GimpBrushGeneratedClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_generated_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrushGenerated),
sizeof (GimpBrushGeneratedClass),
(GtkClassInitFunc) gimp_brush_generated_class_init,
(GtkObjectInitFunc) gimp_brush_generated_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_generated_init,
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushGenerated",
&brush_info, 0);
}
return type;
return brush_type;
}
static void
gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
{
GtkObjectClass *object_class;
GimpDataClass *data_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
data_class = (GimpDataClass *) klass;
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
@ -114,13 +112,6 @@ gimp_brush_generated_init (GimpBrushGenerated *brush)
brush->freeze = 0;
}
static void
gimp_brush_generated_destroy (GtkObject *object)
{
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_brush_generated_save (GimpData *data)
{

View File

@ -56,7 +56,7 @@ struct _GimpBrushGeneratedClass
};
GtkType gimp_brush_generated_get_type (void);
GType gimp_brush_generated_get_type (void);
GimpData * gimp_brush_generated_new (gfloat radius,
gfloat hardness,

View File

@ -57,14 +57,125 @@
#include "libgimp/gimpintl.h"
static void gimp_brush_pipe_class_init (GimpBrushPipeClass *klass);
static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
static void gimp_brush_pipe_finalize (GObject *object);
static GimpBrush * gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool);
static void gimp_brush_pipe_destroy (GtkObject *object);
static GimpBrushClass *parent_class = NULL;
GType
gimp_brush_pipe_get_type (void)
{
static GType brush_type = 0;
if (! brush_type)
{
static const GTypeInfo brush_info =
{
sizeof (GimpBrushPipeClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_pipe_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrushPipe),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_pipe_init,
};
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushPipe",
&brush_info, 0);
}
return brush_type;
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GObjectClass *object_class;
GimpBrushClass *brush_class;
object_class = G_OBJECT_CLASS (klass);
brush_class = GIMP_BRUSH_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_brush_pipe_finalize;
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
}
static void
gimp_brush_pipe_init (GimpBrushPipe *pipe)
{
pipe->current = NULL;
pipe->dimension = 0;
pipe->rank = NULL;
pipe->stride = NULL;
pipe->nbrushes = 0;
pipe->brushes = NULL;
pipe->select = NULL;
pipe->index = NULL;
}
static void
gimp_brush_pipe_finalize (GObject *object)
{
GimpBrushPipe *pipe;
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
pipe = GIMP_BRUSH_PIPE (object);
if (pipe->rank)
{
g_free (pipe->rank);
pipe->rank = NULL;
}
if (pipe->stride)
{
g_free (pipe->stride);
pipe->stride = NULL;
}
if (pipe->brushes)
{
gint i;
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
g_object_unref (G_OBJECT (pipe->brushes[i]));
g_free (pipe->brushes);
pipe->brushes = NULL;
}
if (pipe->select)
{
g_free (pipe->select);
pipe->select = NULL;
}
if (pipe->index)
{
g_free (pipe->index);
pipe->index = NULL;
}
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GimpBrush *
gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
{
@ -151,90 +262,6 @@ gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
return TRUE;
}
static void
gimp_brush_pipe_destroy (GtkObject *object)
{
GimpBrushPipe *pipe;
gint i;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
pipe = GIMP_BRUSH_PIPE (object);
g_free (pipe->rank);
g_free (pipe->stride);
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
g_object_unref (G_OBJECT (pipe->brushes[i]));
g_free (pipe->brushes);
g_free (pipe->select);
g_free (pipe->index);
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GtkObjectClass *object_class;
GimpBrushClass *brush_class;
object_class = (GtkObjectClass *) klass;
brush_class = (GimpBrushClass *) klass;
parent_class = g_type_class_peek_parent (klass);
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
object_class->destroy = gimp_brush_pipe_destroy;
}
void
gimp_brush_pipe_init (GimpBrushPipe *pipe)
{
pipe->current = NULL;
pipe->dimension = 0;
pipe->rank = NULL;
pipe->stride = NULL;
pipe->nbrushes = 0;
pipe->brushes = NULL;
pipe->select = NULL;
pipe->index = NULL;
}
GtkType
gimp_brush_pipe_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
{
"GimpBrushPipe",
sizeof (GimpBrushPipe),
sizeof (GimpBrushPipeClass),
(GtkClassInitFunc) gimp_brush_pipe_class_init,
(GtkObjectInitFunc) gimp_brush_pipe_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
}
return type;
}
GimpData *
gimp_brush_pipe_load (const gchar *filename)
{

View File

@ -57,14 +57,125 @@
#include "libgimp/gimpintl.h"
static void gimp_brush_pipe_class_init (GimpBrushPipeClass *klass);
static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
static void gimp_brush_pipe_finalize (GObject *object);
static GimpBrush * gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool);
static void gimp_brush_pipe_destroy (GtkObject *object);
static GimpBrushClass *parent_class = NULL;
GType
gimp_brush_pipe_get_type (void)
{
static GType brush_type = 0;
if (! brush_type)
{
static const GTypeInfo brush_info =
{
sizeof (GimpBrushPipeClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_pipe_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrushPipe),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_pipe_init,
};
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushPipe",
&brush_info, 0);
}
return brush_type;
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GObjectClass *object_class;
GimpBrushClass *brush_class;
object_class = G_OBJECT_CLASS (klass);
brush_class = GIMP_BRUSH_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_brush_pipe_finalize;
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
}
static void
gimp_brush_pipe_init (GimpBrushPipe *pipe)
{
pipe->current = NULL;
pipe->dimension = 0;
pipe->rank = NULL;
pipe->stride = NULL;
pipe->nbrushes = 0;
pipe->brushes = NULL;
pipe->select = NULL;
pipe->index = NULL;
}
static void
gimp_brush_pipe_finalize (GObject *object)
{
GimpBrushPipe *pipe;
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
pipe = GIMP_BRUSH_PIPE (object);
if (pipe->rank)
{
g_free (pipe->rank);
pipe->rank = NULL;
}
if (pipe->stride)
{
g_free (pipe->stride);
pipe->stride = NULL;
}
if (pipe->brushes)
{
gint i;
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
g_object_unref (G_OBJECT (pipe->brushes[i]));
g_free (pipe->brushes);
pipe->brushes = NULL;
}
if (pipe->select)
{
g_free (pipe->select);
pipe->select = NULL;
}
if (pipe->index)
{
g_free (pipe->index);
pipe->index = NULL;
}
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GimpBrush *
gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
{
@ -151,90 +262,6 @@ gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
return TRUE;
}
static void
gimp_brush_pipe_destroy (GtkObject *object)
{
GimpBrushPipe *pipe;
gint i;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
pipe = GIMP_BRUSH_PIPE (object);
g_free (pipe->rank);
g_free (pipe->stride);
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
g_object_unref (G_OBJECT (pipe->brushes[i]));
g_free (pipe->brushes);
g_free (pipe->select);
g_free (pipe->index);
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GtkObjectClass *object_class;
GimpBrushClass *brush_class;
object_class = (GtkObjectClass *) klass;
brush_class = (GimpBrushClass *) klass;
parent_class = g_type_class_peek_parent (klass);
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
object_class->destroy = gimp_brush_pipe_destroy;
}
void
gimp_brush_pipe_init (GimpBrushPipe *pipe)
{
pipe->current = NULL;
pipe->dimension = 0;
pipe->rank = NULL;
pipe->stride = NULL;
pipe->nbrushes = 0;
pipe->brushes = NULL;
pipe->select = NULL;
pipe->index = NULL;
}
GtkType
gimp_brush_pipe_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
{
"GimpBrushPipe",
sizeof (GimpBrushPipe),
sizeof (GimpBrushPipeClass),
(GtkClassInitFunc) gimp_brush_pipe_class_init,
(GtkObjectInitFunc) gimp_brush_pipe_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
}
return type;
}
GimpData *
gimp_brush_pipe_load (const gchar *filename)
{

View File

@ -72,7 +72,7 @@ struct _GimpBrushPipeClass
};
GtkType gimp_brush_pipe_get_type (void);
GType gimp_brush_pipe_get_type (void);
GimpData * gimp_brush_pipe_load (const gchar *filename);

View File

@ -35,7 +35,9 @@
static void gimp_buffer_class_init (GimpBufferClass *klass);
static void gimp_buffer_init (GimpBuffer *buffer);
static void gimp_buffer_destroy (GtkObject *object);
static void gimp_buffer_finalize (GObject *object);
static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -44,26 +46,29 @@ static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
static GimpViewableClass *parent_class = NULL;
GtkType
GType
gimp_buffer_get_type (void)
{
static GtkType buffer_type = 0;
static GType buffer_type = 0;
if (! buffer_type)
{
static const GtkTypeInfo buffer_info =
static const GTypeInfo buffer_info =
{
"GimpBuffer",
sizeof (GimpBuffer),
sizeof (GimpBufferClass),
(GtkClassInitFunc) gimp_buffer_class_init,
(GtkObjectInitFunc) gimp_buffer_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_buffer_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBuffer),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_buffer_init,
};
buffer_type = gtk_type_unique (GIMP_TYPE_VIEWABLE, &buffer_info);
buffer_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpBuffer",
&buffer_info, 0);
}
return buffer_type;
@ -72,15 +77,15 @@ gimp_buffer_get_type (void)
static void
gimp_buffer_class_init (GimpBufferClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_buffer_destroy;
object_class->finalize = gimp_buffer_finalize;
viewable_class->get_new_preview = gimp_buffer_get_new_preview;
}
@ -92,7 +97,7 @@ gimp_buffer_init (GimpBuffer *buffer)
}
static void
gimp_buffer_destroy (GtkObject *object)
gimp_buffer_finalize (GObject *object)
{
GimpBuffer *buffer;
@ -104,8 +109,7 @@ gimp_buffer_destroy (GtkObject *object)
buffer->tiles = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -45,7 +45,7 @@ struct _GimpBufferClass
};
GtkType gimp_buffer_get_type (void);
GType gimp_buffer_get_type (void);
GimpBuffer * gimp_buffer_new (TileManager *tiles,
const gchar *name);

View File

@ -52,32 +52,36 @@
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static void gimp_channel_finalize (GObject *object);
static GimpDrawableClass * parent_class = NULL;
GtkType
GType
gimp_channel_get_type (void)
{
static GtkType channel_type = 0;
static GType channel_type = 0;
if (!channel_type)
if (! channel_type)
{
GtkTypeInfo channel_info =
static const GTypeInfo channel_info =
{
"GimpChannel",
sizeof (GimpChannelClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_channel_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpChannel),
sizeof (GimpChannelClass),
(GtkClassInitFunc) gimp_channel_class_init,
(GtkObjectInitFunc) gimp_channel_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
0, /* n_preallocs */
(GInstanceInitFunc) gimp_channel_init,
};
channel_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &channel_info);
channel_type = g_type_register_static (GIMP_TYPE_DRAWABLE,
"GimpChannel",
&channel_info, 0);
}
return channel_type;
@ -86,13 +90,13 @@ gimp_channel_get_type (void)
static void
gimp_channel_class_init (GimpChannelClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_channel_destroy;
object_class->finalize = gimp_channel_finalize;
}
static void
@ -118,23 +122,27 @@ gimp_channel_init (GimpChannel *channel)
}
static void
gimp_channel_destroy (GtkObject *object)
gimp_channel_finalize (GObject *object)
{
GimpChannel *channel;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (object));
channel = GIMP_CHANNEL (object);
/* free the segments? */
if (channel->segs_in)
g_free (channel->segs_in);
if (channel->segs_out)
g_free (channel->segs_out);
{
g_free (channel->segs_in);
channel->segs_in = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
if (channel->segs_out)
{
g_free (channel->segs_out);
channel->segs_out = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
@ -240,7 +248,6 @@ void
gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *color)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (color != NULL);
@ -258,7 +265,6 @@ gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *
gimp_channel_get_color (const GimpChannel *channel)
{
g_return_val_if_fail (channel != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
return &channel->color;
@ -267,7 +273,6 @@ gimp_channel_get_color (const GimpChannel *channel)
gint
gimp_channel_get_opacity (const GimpChannel *channel)
{
g_return_val_if_fail (channel != NULL, 0);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), 0);
return (gint) (channel->color.a * 100.999);
@ -277,7 +282,6 @@ void
gimp_channel_set_opacity (GimpChannel *channel,
gint opacity)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
opacity = CLAMP (opacity, 0, 100);
@ -293,6 +297,8 @@ gimp_channel_scale (GimpChannel *channel,
PixelRegion srcPR, destPR;
TileManager *new_tiles;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (new_width == 0 || new_height == 0)
return;
@ -347,6 +353,8 @@ gimp_channel_resize (GimpChannel *channel,
gint w, h;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (!new_width || !new_height)
return;
@ -443,6 +451,8 @@ gimp_channel_new_mask (GimpImage *gimage,
GimpRGB black = { 0.0, 0.0, 0.0, 0.5 };
GimpChannel *new_channel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* Create the new channel */
new_channel = gimp_channel_new (gimage, width, height,
_("Selection Mask"), &black);
@ -468,6 +478,8 @@ gimp_channel_boundary (GimpChannel *mask,
gint x3, y3, x4, y4;
PixelRegion bPR;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
if (! mask->boundary_known)
{
/* free the out of date boundary segments */
@ -532,6 +544,8 @@ gimp_channel_value (GimpChannel *mask,
Tile *tile;
gint val;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), 0);
/* Some checks to cut back on unnecessary work */
if (mask->bounds_known)
{
@ -569,6 +583,8 @@ gimp_channel_bounds (GimpChannel *mask,
gint minx, maxx;
gpointer pr;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
/* if the mask's bounds have already been reliably calculated... */
if (mask->bounds_known)
{
@ -676,6 +692,8 @@ gimp_channel_is_empty (GimpChannel *mask)
gint x, y;
gpointer pr;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
if (mask->bounds_known)
return mask->empty;
@ -732,6 +750,8 @@ gimp_channel_add_segment (GimpChannel *mask,
gint x2;
gpointer pr;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* check horizontal extents... */
x2 = x + width;
if (x2 < 0) x2 = 0;
@ -775,6 +795,8 @@ gimp_channel_sub_segment (GimpChannel *mask,
gint x2;
gpointer pr;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* check horizontal extents... */
x2 = x + width;
if (x2 < 0) x2 = 0;
@ -816,6 +838,8 @@ gimp_channel_combine_rect (GimpChannel *mask,
PixelRegion maskPR;
guchar color;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
y2 = y + h;
x2 = x + w;
@ -885,6 +909,8 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
gfloat rad;
gfloat dist;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (!w || !h)
return;
@ -1021,7 +1047,7 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
}
static void
gimp_channel_combine_sub_region_add (void *unused,
gimp_channel_combine_sub_region_add (gpointer unused,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -1047,7 +1073,7 @@ gimp_channel_combine_sub_region_add (void *unused,
}
static void
gimp_channel_combine_sub_region_sub (void *unused,
gimp_channel_combine_sub_region_sub (gpointer unused,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -1072,7 +1098,7 @@ gimp_channel_combine_sub_region_sub (void *unused,
}
static void
gimp_channel_combine_sub_region_intersect (void *unused,
gimp_channel_combine_sub_region_intersect (gpointer unused,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -1104,6 +1130,9 @@ gimp_channel_combine_mask (GimpChannel *mask,
gint x1, y1, x2, y2;
gint w, h;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_CHANNEL (add_on));
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
x2 = CLAMP (off_x + GIMP_DRAWABLE (add_on)->width, 0,
@ -1156,6 +1185,9 @@ gimp_channel_feather (GimpChannel *input,
gint x1, y1, x2, y2;
PixelRegion srcPR;
g_return_if_fail (GIMP_IS_CHANNEL (input));
g_return_if_fail (GIMP_IS_CHANNEL (output));
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (output)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (output)->height);
x2 = CLAMP (off_x + GIMP_DRAWABLE (input)->width, 0,
@ -1213,6 +1245,8 @@ gimp_channel_clear (GimpChannel *mask)
PixelRegion maskPR;
guchar bg = 0;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1248,6 +1282,8 @@ gimp_channel_invert (GimpChannel *mask)
PixelRegion maskPR;
GimpLut *lut;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1270,6 +1306,8 @@ gimp_channel_sharpen (GimpChannel *mask)
PixelRegion maskPR;
GimpLut *lut;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1290,6 +1328,8 @@ gimp_channel_all (GimpChannel *mask)
PixelRegion maskPR;
guchar bg = 255;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1317,6 +1357,8 @@ gimp_channel_border (GimpChannel *mask,
PixelRegion bPR;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (radius_x < 0 || radius_y < 0)
return;
@ -1362,6 +1404,8 @@ gimp_channel_grow (GimpChannel *mask,
PixelRegion bPR;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (radius_x == 0 && radius_y == 0)
return;
@ -1417,6 +1461,8 @@ gimp_channel_shrink (GimpChannel *mask,
PixelRegion bPR;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (radius_x == 0 && radius_y == 0)
return;
@ -1465,6 +1511,8 @@ gimp_channel_translate (GimpChannel *mask,
guchar empty = 0;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
tmp_mask = NULL;
/* push the current channel onto the undo stack */
@ -1538,6 +1586,9 @@ gimp_channel_load (GimpChannel *mask,
{
PixelRegion srcPR, destPR;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_CHANNEL (channel));
/* push the current mask onto the undo stack */
gimp_channel_push_undo (mask);
@ -1563,6 +1614,9 @@ gimp_channel_layer_alpha (GimpChannel *mask,
guchar empty = 0;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_LAYER (layer));
/* push the current mask onto the undo stack */
gimp_channel_push_undo (mask);
@ -1599,6 +1653,9 @@ gimp_channel_layer_mask (GimpChannel *mask,
guchar empty = 0;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_LAYER (layer));
/* push the current mask onto the undo stack */
gimp_channel_push_undo (mask);
@ -1633,5 +1690,7 @@ gimp_channel_layer_mask (GimpChannel *mask,
void
gimp_channel_invalidate_bounds (GimpChannel *channel)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
channel->bounds_known = FALSE;
}

View File

@ -83,7 +83,7 @@ struct _MaskUndo
/* function declarations */
GtkType gimp_channel_get_type (void);
GType gimp_channel_get_type (void);
GimpChannel * gimp_channel_new (GimpImage *gimage,
gint width,

View File

@ -52,32 +52,36 @@
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_destroy (GtkObject *object);
static void gimp_channel_finalize (GObject *object);
static GimpDrawableClass * parent_class = NULL;
GtkType
GType
gimp_channel_get_type (void)
{
static GtkType channel_type = 0;
static GType channel_type = 0;
if (!channel_type)
if (! channel_type)
{
GtkTypeInfo channel_info =
static const GTypeInfo channel_info =
{
"GimpChannel",
sizeof (GimpChannelClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_channel_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpChannel),
sizeof (GimpChannelClass),
(GtkClassInitFunc) gimp_channel_class_init,
(GtkObjectInitFunc) gimp_channel_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
0, /* n_preallocs */
(GInstanceInitFunc) gimp_channel_init,
};
channel_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &channel_info);
channel_type = g_type_register_static (GIMP_TYPE_DRAWABLE,
"GimpChannel",
&channel_info, 0);
}
return channel_type;
@ -86,13 +90,13 @@ gimp_channel_get_type (void)
static void
gimp_channel_class_init (GimpChannelClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_channel_destroy;
object_class->finalize = gimp_channel_finalize;
}
static void
@ -118,23 +122,27 @@ gimp_channel_init (GimpChannel *channel)
}
static void
gimp_channel_destroy (GtkObject *object)
gimp_channel_finalize (GObject *object)
{
GimpChannel *channel;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (object));
channel = GIMP_CHANNEL (object);
/* free the segments? */
if (channel->segs_in)
g_free (channel->segs_in);
if (channel->segs_out)
g_free (channel->segs_out);
{
g_free (channel->segs_in);
channel->segs_in = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
if (channel->segs_out)
{
g_free (channel->segs_out);
channel->segs_out = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
@ -240,7 +248,6 @@ void
gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *color)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (color != NULL);
@ -258,7 +265,6 @@ gimp_channel_set_color (GimpChannel *channel,
const GimpRGB *
gimp_channel_get_color (const GimpChannel *channel)
{
g_return_val_if_fail (channel != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
return &channel->color;
@ -267,7 +273,6 @@ gimp_channel_get_color (const GimpChannel *channel)
gint
gimp_channel_get_opacity (const GimpChannel *channel)
{
g_return_val_if_fail (channel != NULL, 0);
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), 0);
return (gint) (channel->color.a * 100.999);
@ -277,7 +282,6 @@ void
gimp_channel_set_opacity (GimpChannel *channel,
gint opacity)
{
g_return_if_fail (channel != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (channel));
opacity = CLAMP (opacity, 0, 100);
@ -293,6 +297,8 @@ gimp_channel_scale (GimpChannel *channel,
PixelRegion srcPR, destPR;
TileManager *new_tiles;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (new_width == 0 || new_height == 0)
return;
@ -347,6 +353,8 @@ gimp_channel_resize (GimpChannel *channel,
gint w, h;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (!new_width || !new_height)
return;
@ -443,6 +451,8 @@ gimp_channel_new_mask (GimpImage *gimage,
GimpRGB black = { 0.0, 0.0, 0.0, 0.5 };
GimpChannel *new_channel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
/* Create the new channel */
new_channel = gimp_channel_new (gimage, width, height,
_("Selection Mask"), &black);
@ -468,6 +478,8 @@ gimp_channel_boundary (GimpChannel *mask,
gint x3, y3, x4, y4;
PixelRegion bPR;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
if (! mask->boundary_known)
{
/* free the out of date boundary segments */
@ -532,6 +544,8 @@ gimp_channel_value (GimpChannel *mask,
Tile *tile;
gint val;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), 0);
/* Some checks to cut back on unnecessary work */
if (mask->bounds_known)
{
@ -569,6 +583,8 @@ gimp_channel_bounds (GimpChannel *mask,
gint minx, maxx;
gpointer pr;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
/* if the mask's bounds have already been reliably calculated... */
if (mask->bounds_known)
{
@ -676,6 +692,8 @@ gimp_channel_is_empty (GimpChannel *mask)
gint x, y;
gpointer pr;
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
if (mask->bounds_known)
return mask->empty;
@ -732,6 +750,8 @@ gimp_channel_add_segment (GimpChannel *mask,
gint x2;
gpointer pr;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* check horizontal extents... */
x2 = x + width;
if (x2 < 0) x2 = 0;
@ -775,6 +795,8 @@ gimp_channel_sub_segment (GimpChannel *mask,
gint x2;
gpointer pr;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* check horizontal extents... */
x2 = x + width;
if (x2 < 0) x2 = 0;
@ -816,6 +838,8 @@ gimp_channel_combine_rect (GimpChannel *mask,
PixelRegion maskPR;
guchar color;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
y2 = y + h;
x2 = x + w;
@ -885,6 +909,8 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
gfloat rad;
gfloat dist;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (!w || !h)
return;
@ -1021,7 +1047,7 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
}
static void
gimp_channel_combine_sub_region_add (void *unused,
gimp_channel_combine_sub_region_add (gpointer unused,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -1047,7 +1073,7 @@ gimp_channel_combine_sub_region_add (void *unused,
}
static void
gimp_channel_combine_sub_region_sub (void *unused,
gimp_channel_combine_sub_region_sub (gpointer unused,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -1072,7 +1098,7 @@ gimp_channel_combine_sub_region_sub (void *unused,
}
static void
gimp_channel_combine_sub_region_intersect (void *unused,
gimp_channel_combine_sub_region_intersect (gpointer unused,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -1104,6 +1130,9 @@ gimp_channel_combine_mask (GimpChannel *mask,
gint x1, y1, x2, y2;
gint w, h;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_CHANNEL (add_on));
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (mask)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (mask)->height);
x2 = CLAMP (off_x + GIMP_DRAWABLE (add_on)->width, 0,
@ -1156,6 +1185,9 @@ gimp_channel_feather (GimpChannel *input,
gint x1, y1, x2, y2;
PixelRegion srcPR;
g_return_if_fail (GIMP_IS_CHANNEL (input));
g_return_if_fail (GIMP_IS_CHANNEL (output));
x1 = CLAMP (off_x, 0, GIMP_DRAWABLE (output)->width);
y1 = CLAMP (off_y, 0, GIMP_DRAWABLE (output)->height);
x2 = CLAMP (off_x + GIMP_DRAWABLE (input)->width, 0,
@ -1213,6 +1245,8 @@ gimp_channel_clear (GimpChannel *mask)
PixelRegion maskPR;
guchar bg = 0;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1248,6 +1282,8 @@ gimp_channel_invert (GimpChannel *mask)
PixelRegion maskPR;
GimpLut *lut;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1270,6 +1306,8 @@ gimp_channel_sharpen (GimpChannel *mask)
PixelRegion maskPR;
GimpLut *lut;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1290,6 +1328,8 @@ gimp_channel_all (GimpChannel *mask)
PixelRegion maskPR;
guchar bg = 255;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
/* push the current channel onto the undo stack */
gimp_channel_push_undo (mask);
@ -1317,6 +1357,8 @@ gimp_channel_border (GimpChannel *mask,
PixelRegion bPR;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (radius_x < 0 || radius_y < 0)
return;
@ -1362,6 +1404,8 @@ gimp_channel_grow (GimpChannel *mask,
PixelRegion bPR;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (radius_x == 0 && radius_y == 0)
return;
@ -1417,6 +1461,8 @@ gimp_channel_shrink (GimpChannel *mask,
PixelRegion bPR;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
if (radius_x == 0 && radius_y == 0)
return;
@ -1465,6 +1511,8 @@ gimp_channel_translate (GimpChannel *mask,
guchar empty = 0;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
tmp_mask = NULL;
/* push the current channel onto the undo stack */
@ -1538,6 +1586,9 @@ gimp_channel_load (GimpChannel *mask,
{
PixelRegion srcPR, destPR;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_CHANNEL (channel));
/* push the current mask onto the undo stack */
gimp_channel_push_undo (mask);
@ -1563,6 +1614,9 @@ gimp_channel_layer_alpha (GimpChannel *mask,
guchar empty = 0;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_LAYER (layer));
/* push the current mask onto the undo stack */
gimp_channel_push_undo (mask);
@ -1599,6 +1653,9 @@ gimp_channel_layer_mask (GimpChannel *mask,
guchar empty = 0;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
g_return_if_fail (GIMP_IS_LAYER (layer));
/* push the current mask onto the undo stack */
gimp_channel_push_undo (mask);
@ -1633,5 +1690,7 @@ gimp_channel_layer_mask (GimpChannel *mask,
void
gimp_channel_invalidate_bounds (GimpChannel *channel)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
channel->bounds_known = FALSE;
}

View File

@ -83,7 +83,7 @@ struct _MaskUndo
/* function declarations */
GtkType gimp_channel_get_type (void);
GType gimp_channel_get_type (void);
GimpChannel * gimp_channel_new (GimpImage *gimage,
gint width,

View File

@ -44,11 +44,6 @@ enum
ADD,
REMOVE,
REORDER,
HAVE,
FOREACH,
GET_CHILD_BY_NAME,
GET_CHILD_BY_INDEX,
GET_CHILD_INDEX,
FREEZE,
THAW,
LAST_SIGNAL
@ -59,7 +54,7 @@ enum
static void gimp_container_init (GimpContainer *container);
static void gimp_container_class_init (GimpContainerClass *klass);
static void gimp_container_destroy (GtkObject *object);
static void gimp_container_dispose (GObject *object);
static void gimp_container_child_destroy_callback (GtkObject *object,
gpointer data);
@ -76,19 +71,22 @@ gimp_container_get_type (void)
if (! container_type)
{
GtkTypeInfo container_info =
static const GTypeInfo container_info =
{
"GimpContainer",
sizeof (GimpContainer),
sizeof (GimpContainerClass),
(GtkClassInitFunc) gimp_container_class_init,
(GtkObjectInitFunc) gimp_container_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_container_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpContainer),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_container_init,
};
container_type = gtk_type_unique (GIMP_TYPE_OBJECT, &container_info);
container_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpContainer",
&container_info, 0);
}
return container_type;
@ -108,9 +106,9 @@ gimp_container_init (GimpContainer *container)
static void
gimp_container_class_init (GimpContainerClass* klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -145,57 +143,6 @@ gimp_container_class_init (GimpContainerClass* klass)
GIMP_TYPE_OBJECT,
G_TYPE_INT);
container_signals[HAVE] =
g_signal_new ("have",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpContainerClass, have),
NULL, NULL,
gimp_cclosure_marshal_BOOLEAN__OBJECT,
G_TYPE_BOOLEAN, 1,
GIMP_TYPE_OBJECT);
container_signals[FOREACH] =
g_signal_new ("foreach",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContainerClass, foreach),
NULL, NULL,
gimp_cclosure_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_POINTER);
container_signals[GET_CHILD_BY_NAME] =
g_signal_new ("get_child_by_name",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpContainerClass, get_child_by_name),
NULL, NULL,
gimp_cclosure_marshal_OBJECT__POINTER,
GIMP_TYPE_OBJECT, 1,
G_TYPE_POINTER);
container_signals[GET_CHILD_BY_INDEX] =
g_signal_new ("get_child_by_index",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpContainerClass, get_child_by_index),
NULL, NULL,
gimp_cclosure_marshal_OBJECT__INT,
GIMP_TYPE_OBJECT, 1,
G_TYPE_INT);
container_signals[GET_CHILD_INDEX] =
g_signal_new ("get_child_index",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpContainerClass, get_child_index),
NULL, NULL,
gimp_cclosure_marshal_INT__OBJECT,
G_TYPE_INT, 1,
GIMP_TYPE_OBJECT);
container_signals[FREEZE] =
g_signal_new ("freeze",
G_TYPE_FROM_CLASS (klass),
@ -214,7 +161,7 @@ gimp_container_class_init (GimpContainerClass* klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_container_destroy;
object_class->dispose = gimp_container_dispose;
klass->add = NULL;
klass->remove = NULL;
@ -229,7 +176,7 @@ gimp_container_class_init (GimpContainerClass* klass)
}
static void
gimp_container_destroy (GtkObject *object)
gimp_container_dispose (GObject *object)
{
GimpContainer *container;
@ -237,13 +184,12 @@ gimp_container_destroy (GtkObject *object)
while (container->handlers)
{
gimp_container_remove_handler
(container,
((GimpContainerHandler *) container->handlers->data)->quark);
gimp_container_remove_handler (container,
((GimpContainerHandler *)
container->handlers->data)->quark);
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@ -330,7 +276,7 @@ gimp_container_add (GimpContainer *container,
container->num_children++;
g_signal_emit (GTK_OBJECT (container), container_signals[ADD], 0, object);
g_signal_emit (G_OBJECT (container), container_signals[ADD], 0, object);
return TRUE;
}
@ -450,83 +396,6 @@ gimp_container_reorder (GimpContainer *container,
return TRUE;
}
gboolean
gimp_container_have (GimpContainer *container,
GimpObject *object)
{
gboolean have = FALSE;
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
if (container->num_children < 1)
return FALSE;
g_signal_emit (G_OBJECT (container), container_signals[HAVE], 0,
object, &have);
return have;
}
void
gimp_container_foreach (GimpContainer *container,
GFunc func,
gpointer user_data)
{
g_return_if_fail (GIMP_IS_CONTAINER (container));
g_return_if_fail (func != NULL);
if (container->num_children > 0)
g_signal_emit (G_OBJECT (container), container_signals[FOREACH], 0,
func, user_data);
}
GimpObject *
gimp_container_get_child_by_name (const GimpContainer *container,
const gchar *name)
{
GimpObject *object = NULL;
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_signal_emit (G_OBJECT (container), container_signals[GET_CHILD_BY_NAME], 0,
name, &object);
return object;
}
GimpObject *
gimp_container_get_child_by_index (const GimpContainer *container,
gint index)
{
GimpObject *object = NULL;
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (index >= 0 && index < container->num_children, NULL);
g_signal_emit (G_OBJECT (container), container_signals[GET_CHILD_BY_INDEX], 0,
index, &object);
return object;
}
gint
gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object)
{
gint index = -1;
g_return_val_if_fail (GIMP_IS_CONTAINER (container), -1);
g_return_val_if_fail (object != NULL, -1);
g_return_val_if_fail (g_type_instance_is_a ((GTypeInstance *) object,
container->children_type), -1);
g_signal_emit (G_OBJECT (container), container_signals[GET_CHILD_INDEX], 0,
object, &index);
return index;
}
void
gimp_container_freeze (GimpContainer *container)
{
@ -558,6 +427,67 @@ gimp_container_frozen (GimpContainer *container)
return (container->freeze_count > 0) ? TRUE : FALSE;
}
gboolean
gimp_container_have (GimpContainer *container,
GimpObject *object)
{
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
if (container->num_children < 1)
return FALSE;
return GIMP_CONTAINER_GET_CLASS (container)->have (container, object);
}
void
gimp_container_foreach (GimpContainer *container,
GFunc func,
gpointer user_data)
{
g_return_if_fail (GIMP_IS_CONTAINER (container));
g_return_if_fail (func != NULL);
if (container->num_children < 1)
return;
GIMP_CONTAINER_GET_CLASS (container)->foreach (container, func, user_data);
}
GimpObject *
gimp_container_get_child_by_name (const GimpContainer *container,
const gchar *name)
{
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (name != NULL, NULL);
return GIMP_CONTAINER_GET_CLASS (container)->get_child_by_name (container,
name);
}
GimpObject *
gimp_container_get_child_by_index (const GimpContainer *container,
gint index)
{
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (index >= 0 && index < container->num_children, NULL);
return GIMP_CONTAINER_GET_CLASS (container)->get_child_by_index (container,
index);
}
gint
gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object)
{
g_return_val_if_fail (GIMP_IS_CONTAINER (container), -1);
g_return_val_if_fail (object != NULL, -1);
g_return_val_if_fail (g_type_instance_is_a ((GTypeInstance *) object,
container->children_type), -1);
return GIMP_CONTAINER_GET_CLASS (container)->get_child_index (container,
object);
}
static void
gimp_container_add_handler_foreach_func (GimpObject *object,
GimpContainerHandler *handler)

View File

@ -38,6 +38,7 @@ typedef enum
#define GIMP_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONTAINER, GimpContainerClass))
#define GIMP_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONTAINER))
#define GIMP_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER))
#define GIMP_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONTAINER, GimpContainerClass))
typedef struct _GimpContainerClass GimpContainerClass;
@ -60,26 +61,29 @@ struct _GimpContainerClass
{
GimpObjectClass parent_class;
void (* add) (GimpContainer *container,
GimpObject *object);
void (* remove) (GimpContainer *container,
GimpObject *object);
void (* reorder) (GimpContainer *container,
GimpObject *object,
gint new_index);
gboolean (* have) (GimpContainer *container,
GimpObject *object);
void (* foreach) (GimpContainer *container,
GFunc func,
gpointer user_data);
GimpObject * (* get_child_by_name) (GimpContainer *container,
gchar *name);
GimpObject * (* get_child_by_index) (GimpContainer *container,
gint index);
gint (* get_child_index) (GimpContainer *container,
GimpObject *object);
void (* freeze) (GimpContainer *container);
void (* thaw) (GimpContainer *container);
/* signals */
void (* add) (GimpContainer *container,
GimpObject *object);
void (* remove) (GimpContainer *container,
GimpObject *object);
void (* reorder) (GimpContainer *container,
GimpObject *object,
gint new_index);
void (* freeze) (GimpContainer *container);
void (* thaw) (GimpContainer *container);
/* virtual functions */
gboolean (* have) (const GimpContainer *container,
const GimpObject *object);
void (* foreach) (const GimpContainer *container,
GFunc func,
gpointer user_data);
GimpObject * (* get_child_by_name) (const GimpContainer *container,
const gchar *name);
GimpObject * (* get_child_by_index) (const GimpContainer *container,
gint index);
gint (* get_child_index) (const GimpContainer *container,
const GimpObject *object);
};
@ -100,6 +104,10 @@ gboolean gimp_container_reorder (GimpContainer *container,
GimpObject *object,
gint new_index);
void gimp_container_freeze (GimpContainer *container);
void gimp_container_thaw (GimpContainer *container);
gboolean gimp_container_frozen (GimpContainer *container);
gboolean gimp_container_have (GimpContainer *container,
GimpObject *object);
void gimp_container_foreach (GimpContainer *container,
@ -113,10 +121,6 @@ GimpObject * gimp_container_get_child_by_index (const GimpContainer *container,
gint gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object);
void gimp_container_freeze (GimpContainer *container);
void gimp_container_thaw (GimpContainer *container);
gboolean gimp_container_frozen (GimpContainer *container);
GQuark gimp_container_add_handler (GimpContainer *container,
const gchar *signame,
GCallback callback,

View File

@ -308,8 +308,33 @@ static guint gimp_context_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass * parent_class = NULL;
/*****************************************************************************/
/* private functions *******************************************************/
GType
gimp_context_get_type (void)
{
static GType context_type = 0;
if (! context_type)
{
static const GTypeInfo context_info =
{
sizeof (GimpContextClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_context_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpContext),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_context_init,
};
context_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpContext",
&context_info, 0);
}
return context_type;
}
static void
gimp_context_class_init (GimpContextClass *klass)
@ -730,31 +755,6 @@ gimp_context_get_arg (GtkObject *object,
/*****************************************************************************/
/* public functions ********************************************************/
GType
gimp_context_get_type (void)
{
static GType context_type = 0;
if (! context_type)
{
GtkTypeInfo context_info =
{
"GimpContext",
sizeof (GimpContext),
sizeof (GimpContextClass),
(GtkClassInitFunc) gimp_context_class_init,
(GtkObjectInitFunc) gimp_context_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
context_type = gtk_type_unique (GIMP_TYPE_OBJECT, &context_info);
}
return context_type;
}
GimpContext *
gimp_context_new (Gimp *gimp,
const gchar *name,

View File

@ -80,6 +80,7 @@ typedef enum
#define GIMP_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass))
#define GIMP_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONTEXT))
#define GIMP_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT))
#define GIMP_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, GIMP_TYPE_CONTEXT, GimpContextClass))
typedef struct _GimpContextClass GimpContextClass;

View File

@ -51,7 +51,9 @@ enum
static void gimp_data_class_init (GimpDataClass *klass);
static void gimp_data_init (GimpData *data);
static void gimp_data_destroy (GtkObject *object);
static void gimp_data_finalize (GObject *object);
static void gimp_data_name_changed (GimpObject *object);
static void gimp_data_real_dirty (GimpData *data);
@ -68,19 +70,22 @@ gimp_data_get_type (void)
if (! data_type)
{
static const GtkTypeInfo data_info =
static const GTypeInfo data_info =
{
"GimpData",
sizeof (GimpData),
sizeof (GimpDataClass),
(GtkClassInitFunc) gimp_data_class_init,
(GtkObjectInitFunc) gimp_data_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_data_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpData),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_data_init,
};
data_type = gtk_type_unique (GIMP_TYPE_VIEWABLE, &data_info);
data_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpData",
&data_info, 0);
}
return data_type;
@ -89,11 +94,11 @@ gimp_data_get_type (void)
static void
gimp_data_class_init (GimpDataClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpObjectClass *gimp_object_class;
object_class = (GtkObjectClass *) klass;
gimp_object_class = (GimpObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
gimp_object_class = GIMP_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -133,7 +138,7 @@ gimp_data_class_init (GimpDataClass *klass)
gimp_cclosure_marshal_POINTER__VOID,
G_TYPE_POINTER, 0);
object_class->destroy = gimp_data_destroy;
object_class->finalize = gimp_data_finalize;
gimp_object_class->name_changed = gimp_data_name_changed;
@ -151,16 +156,19 @@ gimp_data_init (GimpData *data)
}
static void
gimp_data_destroy (GtkObject *object)
gimp_data_finalize (GObject *object)
{
GimpData *data;
data = GIMP_DATA (object);
g_free (data->filename);
if (data->filename)
{
g_free (data->filename);
data->filename = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View File

@ -37,7 +37,8 @@
static void gimp_data_factory_class_init (GimpDataFactoryClass *klass);
static void gimp_data_factory_init (GimpDataFactory *factory);
static void gimp_data_factory_destroy (GtkObject *object);
static void gimp_data_factory_finalize (GObject *object);
static void gimp_data_factory_data_load_callback (const gchar *filename,
gpointer callback_data);
@ -46,26 +47,29 @@ static void gimp_data_factory_data_load_callback (const gchar *filename,
static GimpObjectClass *parent_class = NULL;
GtkType
GType
gimp_data_factory_get_type (void)
{
static guint factory_type = 0;
static GType factory_type = 0;
if (! factory_type)
{
GtkTypeInfo factory_info =
static const GTypeInfo factory_info =
{
"GimpDataFactory",
sizeof (GimpDataFactoryClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_data_factory_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDataFactory),
sizeof (GimpDataFactoryClass),
(GtkClassInitFunc) gimp_data_factory_class_init,
(GtkObjectInitFunc) gimp_data_factory_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_data_factory_init,
};
factory_type = gtk_type_unique (GIMP_TYPE_OBJECT, &factory_info);
factory_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpDataFactory",
&factory_info, 0);
}
return factory_type;
@ -74,13 +78,13 @@ gimp_data_factory_get_type (void)
static void
gimp_data_factory_class_init (GimpDataFactoryClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_data_factory_destroy;
object_class->finalize = gimp_data_factory_finalize;
}
static void
@ -95,7 +99,7 @@ gimp_data_factory_init (GimpDataFactory *factory)
}
static void
gimp_data_factory_destroy (GtkObject *object)
gimp_data_factory_finalize (GObject *object)
{
GimpDataFactory *factory;
@ -107,12 +111,11 @@ gimp_data_factory_destroy (GtkObject *object)
factory->container = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GimpDataFactory *
gimp_data_factory_new (GtkType data_type,
gimp_data_factory_new (GType data_type,
const gchar **data_path,
const GimpDataFactoryLoaderEntry *loader_entries,
gint n_loader_entries,
@ -121,7 +124,7 @@ gimp_data_factory_new (GtkType data_type,
{
GimpDataFactory *factory;
g_return_val_if_fail (gtk_type_is_a (data_type, GIMP_TYPE_DATA), NULL);
g_return_val_if_fail (g_type_is_a (data_type, GIMP_TYPE_DATA), NULL);
g_return_val_if_fail (data_path != NULL, NULL);
g_return_val_if_fail (loader_entries != NULL, NULL);
g_return_val_if_fail (n_loader_entries > 0, NULL);
@ -148,7 +151,6 @@ void
gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data /* FIXME */)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
gimp_container_freeze (factory->container);
@ -172,7 +174,6 @@ gimp_data_factory_data_save (GimpDataFactory *factory)
GimpList *gimp_list;
GList *list;
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (gimp_container_num_children (factory->container) == 0)
@ -208,7 +209,6 @@ gimp_data_factory_data_free (GimpDataFactory *factory)
{
GimpList *list;
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (gimp_container_num_children (factory->container) == 0)
@ -231,7 +231,6 @@ GimpData *
gimp_data_factory_data_new (GimpDataFactory *factory,
const gchar *name)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (name != NULL, NULL);
@ -252,7 +251,6 @@ gimp_data_factory_data_new (GimpDataFactory *factory,
GimpData *
gimp_data_factory_data_get_standard (GimpDataFactory *factory)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
if (factory->data_get_standard_func)

View File

@ -70,8 +70,9 @@ struct _GimpDataFactoryClass
};
GtkType gimp_data_factory_get_type (void);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
GType gimp_data_factory_get_type (void);
GimpDataFactory * gimp_data_factory_new (GType data_type,
const gchar **data_path,
const GimpDataFactoryLoaderEntry *loader_entries,
gint n_loader_entries,

View File

@ -57,26 +57,29 @@ static GimpListClass *parent_class = NULL;
GType
gimp_data_list_get_type (void)
{
static GType type = 0;
static GType list_type = 0;
if (!type)
if (! list_type)
{
GtkTypeInfo info =
static const GTypeInfo list_info =
{
"GimpDataList",
sizeof (GimpDataListClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_data_list_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDataList),
sizeof (GimpDataListClass),
(GtkClassInitFunc) gimp_data_list_class_init,
(GtkObjectInitFunc) gimp_data_list_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_data_list_init,
};
type = gtk_type_unique (GIMP_TYPE_LIST, &info);
list_type = g_type_register_static (GIMP_TYPE_LIST,
"GimpDataList",
&list_info, 0);
}
return type;
return list_type;
}
static void
@ -84,7 +87,7 @@ gimp_data_list_class_init (GimpDataListClass *klass)
{
GimpContainerClass *container_class;
container_class = (GimpContainerClass *) klass;
container_class = GIMP_CONTAINER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);

View File

@ -28,9 +28,10 @@
#define GIMP_TYPE_DATA_LIST (gimp_data_list_get_type ())
#define GIMP_DATA_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DATA_LIST, GimpDataList))
#define GIMP_DATA_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GIMP_TYPE_DATA_LIST, GimpDataListClass))
#define GIMP_DATA_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA_LIST, GimpDataListClass))
#define GIMP_IS_DATA_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DATA_LIST))
#define GIMP_IS_DATA_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_LIST))
#define GIMP_DATA_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DATA_LIST, GimpDataListClass))
typedef struct _GimpDataListClass GimpDataListClass;

View File

@ -66,7 +66,9 @@ enum
static void gimp_drawable_class_init (GimpDrawableClass *klass);
static void gimp_drawable_init (GimpDrawable *drawable);
static void gimp_drawable_destroy (GtkObject *object);
static void gimp_drawable_finalize (GObject *object);
static void gimp_drawable_name_changed (GimpObject *drawable);
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
@ -78,26 +80,29 @@ static guint gimp_drawable_signals[LAST_SIGNAL] = { 0 };
static GimpViewableClass *parent_class = NULL;
GtkType
GType
gimp_drawable_get_type (void)
{
static GtkType drawable_type = 0;
static GType drawable_type = 0;
if (! drawable_type)
{
GtkTypeInfo drawable_info =
static const GTypeInfo drawable_info =
{
"GimpDrawable",
sizeof (GimpDrawableClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_drawable_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDrawable),
sizeof (GimpDrawableClass),
(GtkClassInitFunc) gimp_drawable_class_init,
(GtkObjectInitFunc) gimp_drawable_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
0, /* n_preallocs */
(GInstanceInitFunc) gimp_drawable_init,
};
drawable_type = gtk_type_unique (GIMP_TYPE_VIEWABLE, &drawable_info);
drawable_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpDrawable",
&drawable_info, 0);
}
return drawable_type;
@ -106,13 +111,13 @@ gimp_drawable_get_type (void)
static void
gimp_drawable_class_init (GimpDrawableClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpObjectClass *gimp_object_class;
GimpViewableClass *viewable_class;
object_class = (GtkObjectClass *) klass;
gimp_object_class = (GimpObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
object_class = G_OBJECT_CLASS (klass);
gimp_object_class = GIMP_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -134,7 +139,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_drawable_destroy;
object_class->finalize = gimp_drawable_finalize;
gimp_object_class->name_changed = gimp_drawable_name_changed;
@ -168,7 +173,7 @@ gimp_drawable_init (GimpDrawable *drawable)
}
static void
gimp_drawable_destroy (GtkObject *object)
gimp_drawable_finalize (GObject *object)
{
GimpDrawable *drawable;
@ -176,8 +181,12 @@ gimp_drawable_destroy (GtkObject *object)
drawable = GIMP_DRAWABLE (object);
g_hash_table_remove (drawable->gimage->gimp->drawable_table,
GINT_TO_POINTER (drawable->ID));
if (drawable->gimage && drawable->gimage->gimp)
{
g_hash_table_remove (drawable->gimage->gimp->drawable_table,
GINT_TO_POINTER (drawable->ID));
drawable->gimage = NULL;
}
if (drawable->tiles)
{
@ -194,8 +203,7 @@ gimp_drawable_destroy (GtkObject *object)
drawable->parasites = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
@ -383,7 +391,6 @@ gimp_drawable_configure (GimpDrawable *drawable,
gint
gimp_drawable_get_ID (GimpDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, -1);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
return drawable->ID;
@ -393,7 +400,6 @@ GimpDrawable *
gimp_drawable_get_by_ID (Gimp *gimp,
gint drawable_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->drawable_table == NULL)
@ -437,7 +443,6 @@ gimp_drawable_update (GimpDrawable *drawable,
gint offset_x;
gint offset_y;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
@ -462,7 +467,6 @@ gimp_drawable_apply_image (GimpDrawable *drawable,
TileManager *tiles,
gint sparse)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (! tiles)
@ -481,12 +485,11 @@ gimp_drawable_merge_shadow (GimpDrawable *drawable,
PixelRegion shadowPR;
gint x1, y1, x2, y2;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
g_return_if_fail (gimage != NULL);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (gimage->shadow != NULL);
/* A useful optimization here is to limit the update to the
@ -509,7 +512,6 @@ gimp_drawable_fill (GimpDrawable *drawable,
guchar c[MAX_CHANNELS];
guchar i;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_drawable_gimage (drawable);
@ -579,7 +581,6 @@ gimp_drawable_fill_by_type (GimpDrawable *drawable,
{
GimpRGB color;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
color.a = 1.0;
@ -623,7 +624,6 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
GimpImage *gimage;
gint off_x, off_y;
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
gimage = gimp_drawable_gimage (drawable);
@ -656,7 +656,6 @@ gimp_drawable_mask_bounds (GimpDrawable *drawable,
void
gimp_drawable_removed (GimpDrawable *drawable)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_signal_emit (G_OBJECT (drawable), gimp_drawable_signals[REMOVED], 0);
@ -716,7 +715,6 @@ gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
gboolean
gimp_drawable_get_visible (const GimpDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return drawable->visible;
@ -726,7 +724,6 @@ void
gimp_drawable_set_visible (GimpDrawable *drawable,
gboolean visible)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
visible = visible ? TRUE : FALSE;
@ -756,7 +753,7 @@ gimp_drawable_get_color_at (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_drawable_gimage (drawable) ||
!gimp_drawable_is_indexed (drawable), NULL);
! gimp_drawable_is_indexed (drawable), NULL);
/* do not make this a g_return_if_fail() */
if ( !(x >= 0 && x < drawable->width && y >= 0 && y < drawable->height))
@ -810,7 +807,6 @@ gimp_drawable_parasite_list (const GimpDrawable *drawable,
gchar **list;
gchar **cur;
g_return_val_if_fail (drawable != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (count != NULL, NULL);

View File

@ -66,7 +66,7 @@ struct _GimpDrawableClass
/* drawable access functions */
GtkType gimp_drawable_get_type (void);
GType gimp_drawable_get_type (void);
void gimp_drawable_configure (GimpDrawable *drawable,
GimpImage *gimage,

View File

@ -45,7 +45,9 @@
static void gimp_gradient_class_init (GimpGradientClass *klass);
static void gimp_gradient_init (GimpGradient *gradient);
static void gimp_gradient_destroy (GtkObject *object);
static void gimp_gradient_finalize (GObject *object);
static TempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -76,19 +78,22 @@ gimp_gradient_get_type (void)
if (! gradient_type)
{
static const GtkTypeInfo gradient_info =
static const GTypeInfo gradient_info =
{
"GimpGradient",
sizeof (GimpGradient),
sizeof (GimpGradientClass),
(GtkClassInitFunc) gimp_gradient_class_init,
(GtkObjectInitFunc) gimp_gradient_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_gradient_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpGradient),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_gradient_init,
};
gradient_type = gtk_type_unique (GIMP_TYPE_DATA, &gradient_info);
gradient_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpGradient",
&gradient_info, 0);
}
return gradient_type;
@ -97,24 +102,24 @@ gimp_gradient_get_type (void)
static void
gimp_gradient_class_init (GimpGradientClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_gradient_destroy;
object_class->finalize = gimp_gradient_finalize;
viewable_class->get_new_preview = gimp_gradient_get_new_preview;
data_class->dirty = gimp_gradient_dirty;
data_class->save = gimp_gradient_save;
data_class->get_extension = gimp_gradient_get_extension;
data_class->duplicate = gimp_gradient_duplicate;
data_class->dirty = gimp_gradient_dirty;
data_class->save = gimp_gradient_save;
data_class->get_extension = gimp_gradient_get_extension;
data_class->duplicate = gimp_gradient_duplicate;
}
static void
@ -125,17 +130,19 @@ gimp_gradient_init (GimpGradient *gradient)
}
static void
gimp_gradient_destroy (GtkObject *object)
gimp_gradient_finalize (GObject *object)
{
GimpGradient *gradient;
gradient = GIMP_GRADIENT (object);
if (gradient->segments)
gimp_gradient_segments_free (gradient->segments);
{
gimp_gradient_segments_free (gradient->segments);
gradient->segments = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *
@ -330,7 +337,7 @@ gimp_gradient_load (const gchar *filename)
{
g_message ("%s(): invalid number of segments in \"%s\"",
G_GNUC_FUNCTION, filename);
gtk_object_sink (GTK_OBJECT (gradient));
g_object_unref (G_OBJECT (gradient));
fclose (file);
return NULL;
}

View File

@ -47,7 +47,7 @@ typedef enum
} AutoCropType;
typedef guchar * (* GetColorFunc) (GtkObject *crop_object,
typedef guchar * (* GetColorFunc) (GObject *crop_object,
gint ,
gint );
typedef AutoCropType (* ColorsEqualFunc) (guchar *,
@ -63,7 +63,7 @@ static void gimp_image_crop_adjust_guides (GimpImage *gimage,
gint x2,
gint y2);
static AutoCropType gimp_image_crop_guess_bgcolor (GtkObject *get_color_obj,
static AutoCropType gimp_image_crop_guess_bgcolor (GObject *get_color_obj,
GetColorFunc get_color_func,
gint bytes,
gboolean has_alpha,
@ -243,7 +243,7 @@ gimp_image_crop_auto_shrink (GimpImage *gimage,
GimpDrawable *active_drawable = NULL;
GetColorFunc get_color_func;
ColorsEqualFunc colors_equal_func;
GtkObject *get_color_obj;
GObject *get_color_obj;
guchar bgcolor[MAX_CHANNELS] = { 0, 0, 0, 0 };
gboolean has_alpha;
PixelRegion PR;
@ -276,14 +276,14 @@ gimp_image_crop_auto_shrink (GimpImage *gimage,
bytes = gimp_drawable_bytes (GIMP_DRAWABLE (active_drawable));
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (active_drawable));
get_color_obj = GTK_OBJECT (active_drawable);
get_color_obj = G_OBJECT (active_drawable);
get_color_func = (GetColorFunc) gimp_drawable_get_color_at;
}
else
{
has_alpha = TRUE;
bytes = gimp_image_composite_bytes (gimage);
get_color_obj = GTK_OBJECT (gimage);
get_color_obj = G_OBJECT (gimage);
get_color_func = (GetColorFunc) gimp_image_get_color_at;
}
@ -434,7 +434,7 @@ gimp_image_crop_adjust_guides (GimpImage *gimage,
}
static AutoCropType
gimp_image_crop_guess_bgcolor (GtkObject *get_color_obj,
gimp_image_crop_guess_bgcolor (GObject *get_color_obj,
GetColorFunc get_color_func,
gint bytes,
gboolean has_alpha,
@ -448,7 +448,7 @@ gimp_image_crop_guess_bgcolor (GtkObject *get_color_obj,
guchar *tr = NULL;
guchar *bl = NULL;
guchar *br = NULL;
gint i, alpha;
gint i, alpha;
for (i = 0; i < bytes; i++)
color[i] = 0;

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -62,7 +62,9 @@ enum
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_destroy (GtkObject *object);
static void gimp_layer_finalize (GObject *object);
static void gimp_layer_invalidate_preview (GimpViewable *viewable);
static void gimp_layer_transform_color (GimpImage *gimage,
@ -77,26 +79,29 @@ static guint layer_signals[LAST_SIGNAL] = { 0 };
static GimpDrawableClass *parent_class = NULL;
GtkType
GType
gimp_layer_get_type (void)
{
static GtkType layer_type = 0;
static GType layer_type = 0;
if (! layer_type)
{
GtkTypeInfo layer_info =
static const GTypeInfo layer_info =
{
"GimpLayer",
sizeof (GimpLayerClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_layer_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpLayer),
sizeof (GimpLayerClass),
(GtkClassInitFunc) gimp_layer_class_init,
(GtkObjectInitFunc) gimp_layer_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
0, /* n_preallocs */
(GInstanceInitFunc) gimp_layer_init,
};
layer_type = gtk_type_unique (GIMP_TYPE_DRAWABLE, &layer_info);
layer_type = g_type_register_static (GIMP_TYPE_DRAWABLE,
"GimpLayer",
&layer_info, 0);
}
return layer_type;
@ -105,13 +110,11 @@ gimp_layer_get_type (void)
static void
gimp_layer_class_init (GimpLayerClass *klass)
{
GtkObjectClass *object_class;
GimpDrawableClass *drawable_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
object_class = (GtkObjectClass *) klass;
drawable_class = (GimpDrawableClass *) klass;
viewable_class = (GimpViewableClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -160,7 +163,7 @@ gimp_layer_class_init (GimpLayerClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_layer_destroy;
object_class->finalize = gimp_layer_finalize;
viewable_class->invalidate_preview = gimp_layer_invalidate_preview;
@ -187,6 +190,37 @@ gimp_layer_init (GimpLayer *layer)
layer->fs.num_segs = 0;
}
static void
gimp_layer_finalize (GObject *object)
{
GimpLayer *layer;
g_return_if_fail (GIMP_IS_LAYER (object));
layer = GIMP_LAYER (object);
if (layer->mask)
{
g_object_unref (G_OBJECT (layer->mask));
layer->mask = NULL;
}
if (layer->fs.segs)
{
g_free (layer->fs.segs);
layer->fs.segs = NULL;
}
/* free the floating selection if it exists */
if (layer->fs.backing_store)
{
tile_manager_destroy (layer->fs.backing_store);
layer->fs.backing_store = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_layer_invalidate_preview (GimpViewable *viewable)
{
@ -623,39 +657,6 @@ gimp_layer_create_mask (GimpLayer *layer,
return mask;
}
static void
gimp_layer_destroy (GtkObject *object)
{
GimpLayer *layer;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_LAYER (object));
layer = GIMP_LAYER (object);
if (layer->mask)
{
g_object_unref (G_OBJECT (layer->mask));
layer->mask = NULL;
}
if (layer->fs.segs)
{
g_free (layer->fs.segs);
layer->fs.segs = NULL;
}
/* free the floating selection if it exists */
if (gimp_layer_is_floating_sel (layer))
{
tile_manager_destroy (layer->fs.backing_store);
layer->fs.backing_store = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
void
gimp_layer_apply_mask (GimpLayer *layer,
MaskApplyMode mode,

View File

@ -28,6 +28,7 @@
#define GIMP_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER, GimpLayerClass))
#define GIMP_IS_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER))
#define GIMP_IS_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER))
#define GIMP_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER, GimpLayerClass))
typedef struct _GimpLayerClass GimpLayerClass;
@ -87,7 +88,7 @@ struct _FStoLayerUndo
/* function declarations */
GtkType gimp_layer_get_type (void);
GType gimp_layer_get_type (void);
GimpLayer * gimp_layer_new (GimpImage *gimage,
gint width,

View File

@ -49,7 +49,6 @@ enum
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
@ -57,26 +56,29 @@ static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
static GimpChannelClass *parent_class = NULL;
GtkType
GType
gimp_layer_mask_get_type (void)
{
static GtkType layer_mask_type = 0;
static GType layer_mask_type = 0;
if (! layer_mask_type)
{
GtkTypeInfo layer_mask_info =
static const GTypeInfo layer_mask_info =
{
"GimpLayerMask",
sizeof (GimpLayerMaskClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_layer_mask_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpLayerMask),
sizeof (GimpLayerMaskClass),
(GtkClassInitFunc) gimp_layer_mask_class_init,
(GtkObjectInitFunc) gimp_layer_mask_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
0, /* n_preallocs */
(GInstanceInitFunc) gimp_layer_mask_init,
};
layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info);
layer_mask_type = g_type_register_static (GIMP_TYPE_CHANNEL,
"GimpLayerMask",
&layer_mask_info, 0);
}
return layer_mask_type;
@ -85,10 +87,6 @@ gimp_layer_mask_get_type (void)
static void
gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
layer_mask_signals[APPLY_CHANGED] =
@ -117,33 +115,17 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_layer_mask_destroy;
}
static void
gimp_layer_mask_init (GimpLayerMask *layer_mask)
{
layer_mask->layer = NULL;
layer_mask->apply_mask = TRUE;
layer_mask->edit_mask = TRUE;
layer_mask->show_mask = FALSE;
}
static void
gimp_layer_mask_destroy (GtkObject *object)
{
GimpLayerMask *layer_mask;
g_return_if_fail (GIMP_IS_LAYER_MASK (object));
layer_mask = GIMP_LAYER_MASK (object);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GimpLayerMask *
gimp_layer_mask_new (GimpImage *gimage,
gint width,

View File

@ -28,6 +28,7 @@
#define GIMP_LAYER_MASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_MASK, GimpLayerMaskClass))
#define GIMP_IS_LAYER_MASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_MASK))
#define GIMP_IS_LAYER_MASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER_MASK))
#define GIMP_LAYER_MASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER_MASK, GimpLayerMaskClass))
typedef struct _GimpLayerMaskClass GimpLayerMaskClass;
@ -65,7 +66,7 @@ struct _LayerMaskUndo
/* function declarations */
GtkType gimp_layer_mask_get_type (void);
GType gimp_layer_mask_get_type (void);
GimpLayerMask * gimp_layer_mask_new (GimpImage *gimage,
gint width,

View File

@ -30,27 +30,27 @@
#include "gimplist.h"
static void gimp_list_class_init (GimpListClass *klass);
static void gimp_list_init (GimpList *list);
static void gimp_list_destroy (GtkObject *object);
static void gimp_list_add (GimpContainer *container,
GimpObject *object);
static void gimp_list_remove (GimpContainer *container,
GimpObject *object);
static void gimp_list_reorder (GimpContainer *container,
GimpObject *object,
gint new_index);
static gboolean gimp_list_have (GimpContainer *container,
GimpObject *object);
static void gimp_list_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
static GimpObject * gimp_list_get_child_by_name (GimpContainer *container,
gchar *name);
static GimpObject * gimp_list_get_child_by_index (GimpContainer *container,
gint index);
static gint gimp_list_get_child_index (GimpContainer *container,
GimpObject *object);
static void gimp_list_class_init (GimpListClass *klass);
static void gimp_list_init (GimpList *list);
static void gimp_list_dispose (GObject *object);
static void gimp_list_add (GimpContainer *container,
GimpObject *object);
static void gimp_list_remove (GimpContainer *container,
GimpObject *object);
static void gimp_list_reorder (GimpContainer *container,
GimpObject *object,
gint new_index);
static gboolean gimp_list_have (const GimpContainer *container,
const GimpObject *object);
static void gimp_list_foreach (const GimpContainer *container,
GFunc func,
gpointer user_data);
static GimpObject * gimp_list_get_child_by_name (const GimpContainer *container,
const gchar *name);
static GimpObject * gimp_list_get_child_by_index (const GimpContainer *container,
gint index);
static gint gimp_list_get_child_index (const GimpContainer *container,
const GimpObject *object);
static GimpContainerClass *parent_class = NULL;
@ -63,19 +63,22 @@ gimp_list_get_type (void)
if (! list_type)
{
GtkTypeInfo list_info =
static const GTypeInfo list_info =
{
"GimpList",
sizeof (GimpListClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_list_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpList),
sizeof (GimpListClass),
(GtkClassInitFunc) gimp_list_class_init,
(GtkObjectInitFunc) gimp_list_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_list_init,
};
list_type = gtk_type_unique (GIMP_TYPE_CONTAINER, &list_info);
list_type = g_type_register_static (GIMP_TYPE_CONTAINER,
"GimpList",
&list_info, 0);
}
return list_type;
@ -84,15 +87,15 @@ gimp_list_get_type (void)
static void
gimp_list_class_init (GimpListClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpContainerClass *container_class;
object_class = (GtkObjectClass *) klass;
container_class = (GimpContainerClass *) klass;
object_class = G_OBJECT_CLASS (klass);
container_class = GIMP_CONTAINER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_list_destroy;
object_class->dispose = gimp_list_dispose;
container_class->add = gimp_list_add;
container_class->remove = gimp_list_remove;
@ -111,7 +114,7 @@ gimp_list_init (GimpList *list)
}
static void
gimp_list_destroy (GtkObject *object)
gimp_list_dispose (GObject *object)
{
GimpList *list;
@ -123,8 +126,7 @@ gimp_list_destroy (GtkObject *object)
GIMP_OBJECT (list->list->data));
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
@ -167,8 +169,8 @@ gimp_list_reorder (GimpContainer *container,
}
static gboolean
gimp_list_have (GimpContainer *container,
GimpObject *object)
gimp_list_have (const GimpContainer *container,
const GimpObject *object)
{
GimpList *list;
@ -178,9 +180,9 @@ gimp_list_have (GimpContainer *container,
}
static void
gimp_list_foreach (GimpContainer *container,
GFunc func,
gpointer user_data)
gimp_list_foreach (const GimpContainer *container,
GFunc func,
gpointer user_data)
{
GimpList *list;
@ -195,7 +197,7 @@ gimp_list_new (GType children_type,
{
GimpList *list;
g_return_val_if_fail (gtk_type_is_a (children_type, GIMP_TYPE_OBJECT), NULL);
g_return_val_if_fail (g_type_is_a (children_type, GIMP_TYPE_OBJECT), NULL);
g_return_val_if_fail (policy == GIMP_CONTAINER_POLICY_STRONG ||
policy == GIMP_CONTAINER_POLICY_WEAK, NULL);
@ -208,8 +210,8 @@ gimp_list_new (GType children_type,
}
static GimpObject *
gimp_list_get_child_by_name (GimpContainer *container,
gchar *name)
gimp_list_get_child_by_name (const GimpContainer *container,
const gchar *name)
{
GimpList *list;
GimpObject *object;
@ -229,8 +231,8 @@ gimp_list_get_child_by_name (GimpContainer *container,
}
static GimpObject *
gimp_list_get_child_by_index (GimpContainer *container,
gint index)
gimp_list_get_child_by_index (const GimpContainer *container,
gint index)
{
GimpList *list;
GList *glist;
@ -246,8 +248,8 @@ gimp_list_get_child_by_index (GimpContainer *container,
}
static gint
gimp_list_get_child_index (GimpContainer *container,
GimpObject *object)
gimp_list_get_child_index (const GimpContainer *container,
const GimpObject *object)
{
GimpList *list;

View File

@ -35,24 +35,26 @@ enum
enum
{
ARG_0,
ARG_NAME
PROP_0,
PROP_NAME
};
static void gimp_object_class_init (GimpObjectClass *klass);
static void gimp_object_init (GimpObject *object);
static void gimp_object_class_init (GimpObjectClass *klass);
static void gimp_object_init (GimpObject *object);
static void gimp_object_destroy (GtkObject *object);
static void gimp_object_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gimp_object_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gimp_object_finalize (GObject *object);
static void gimp_object_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_object_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static guint object_signals[LAST_SIGNAL] = { 0 };
static guint object_signals[LAST_SIGNAL] = { 0 };
static GtkObjectClass *parent_class = NULL;
@ -64,19 +66,22 @@ gimp_object_get_type (void)
if (! object_type)
{
GtkTypeInfo object_info =
static const GTypeInfo object_info =
{
"GimpObject",
sizeof (GimpObject),
sizeof (GimpObjectClass),
(GtkClassInitFunc) gimp_object_class_init,
(GtkObjectInitFunc) gimp_object_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_object_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpObject),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_object_init,
};
object_type = gtk_type_unique (GTK_TYPE_OBJECT, &object_info);
object_type = g_type_register_static (GTK_TYPE_OBJECT,
"GimpObject",
&object_info, 0);
}
return object_type;
@ -85,15 +90,12 @@ gimp_object_get_type (void)
static void
gimp_object_class_init (GimpObjectClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
gtk_object_add_arg_type ("GimpObject::name", GTK_TYPE_STRING,
GTK_ARG_READWRITE, ARG_NAME);
object_signals[NAME_CHANGED] =
g_signal_new ("name_changed",
G_TYPE_FROM_CLASS (klass),
@ -103,11 +105,18 @@ gimp_object_class_init (GimpObjectClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->destroy = gimp_object_destroy;
object_class->set_arg = gimp_object_set_arg;
object_class->get_arg = gimp_object_get_arg;
object_class->finalize = gimp_object_finalize;
object_class->set_property = gimp_object_set_property;
object_class->get_property = gimp_object_get_property;
klass->name_changed = NULL;
klass->name_changed = NULL;
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
NULL, NULL,
NULL,
G_PARAM_READWRITE));
}
static void
@ -117,7 +126,7 @@ gimp_object_init (GimpObject *object)
}
static void
gimp_object_destroy (GtkObject *object)
gimp_object_finalize (GObject *object)
{
GimpObject *gimp_object;
@ -129,45 +138,47 @@ gimp_object_destroy (GtkObject *object)
gimp_object->name = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_object_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gimp_object_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpObject *gimp_object;
gimp_object = GIMP_OBJECT (object);
switch (arg_id)
switch (property_id)
{
case ARG_NAME:
gimp_object_set_name (gimp_object, GTK_VALUE_STRING (*arg));
case PROP_NAME:
gimp_object_set_name (gimp_object, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_object_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gimp_object_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpObject *gimp_object;
gimp_object = GIMP_OBJECT (object);
switch (arg_id)
switch (property_id)
{
case ARG_NAME:
GTK_VALUE_STRING (*arg) = g_strdup (gimp_object->name);
case PROP_NAME:
g_value_set_string (value, gimp_object->name);
break;
default:
arg->type = GTK_TYPE_INVALID;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}

View File

@ -42,7 +42,9 @@
static void gimp_palette_class_init (GimpPaletteClass *klass);
static void gimp_palette_init (GimpPalette *palette);
static void gimp_palette_destroy (GtkObject *object);
static void gimp_palette_finalize (GObject *object);
static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -65,19 +67,22 @@ gimp_palette_get_type (void)
if (! palette_type)
{
GtkTypeInfo palette_info =
static const GTypeInfo palette_info =
{
"GimpPalette",
sizeof (GimpPalette),
sizeof (GimpPaletteClass),
(GtkClassInitFunc) gimp_palette_class_init,
(GtkObjectInitFunc) gimp_palette_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_palette_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPalette),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_palette_init,
};
palette_type = gtk_type_unique (GIMP_TYPE_DATA, &palette_info);
palette_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpPalette",
&palette_info, 0);
}
return palette_type;
@ -86,23 +91,23 @@ gimp_palette_get_type (void)
static void
gimp_palette_class_init (GimpPaletteClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_palette_destroy;
object_class->finalize = gimp_palette_finalize;
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -110,14 +115,13 @@ gimp_palette_init (GimpPalette *palette)
{
palette->colors = NULL;
palette->n_colors = 0;
palette->n_columns = 0;
}
static void
gimp_palette_destroy (GtkObject *object)
gimp_palette_finalize (GObject *object)
{
GimpPalette *palette;
GimpPalette *palette;
g_return_if_fail (GIMP_IS_PALETTE (object));
@ -130,8 +134,7 @@ gimp_palette_destroy (GtkObject *object)
palette->colors = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -42,7 +42,9 @@
static void gimp_palette_class_init (GimpPaletteClass *klass);
static void gimp_palette_init (GimpPalette *palette);
static void gimp_palette_destroy (GtkObject *object);
static void gimp_palette_finalize (GObject *object);
static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -65,19 +67,22 @@ gimp_palette_get_type (void)
if (! palette_type)
{
GtkTypeInfo palette_info =
static const GTypeInfo palette_info =
{
"GimpPalette",
sizeof (GimpPalette),
sizeof (GimpPaletteClass),
(GtkClassInitFunc) gimp_palette_class_init,
(GtkObjectInitFunc) gimp_palette_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_palette_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPalette),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_palette_init,
};
palette_type = gtk_type_unique (GIMP_TYPE_DATA, &palette_info);
palette_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpPalette",
&palette_info, 0);
}
return palette_type;
@ -86,23 +91,23 @@ gimp_palette_get_type (void)
static void
gimp_palette_class_init (GimpPaletteClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_palette_destroy;
object_class->finalize = gimp_palette_finalize;
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -110,14 +115,13 @@ gimp_palette_init (GimpPalette *palette)
{
palette->colors = NULL;
palette->n_colors = 0;
palette->n_columns = 0;
}
static void
gimp_palette_destroy (GtkObject *object)
gimp_palette_finalize (GObject *object)
{
GimpPalette *palette;
GimpPalette *palette;
g_return_if_fail (GIMP_IS_PALETTE (object));
@ -130,8 +134,7 @@ gimp_palette_destroy (GtkObject *object)
palette->colors = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -42,7 +42,9 @@
static void gimp_palette_class_init (GimpPaletteClass *klass);
static void gimp_palette_init (GimpPalette *palette);
static void gimp_palette_destroy (GtkObject *object);
static void gimp_palette_finalize (GObject *object);
static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -65,19 +67,22 @@ gimp_palette_get_type (void)
if (! palette_type)
{
GtkTypeInfo palette_info =
static const GTypeInfo palette_info =
{
"GimpPalette",
sizeof (GimpPalette),
sizeof (GimpPaletteClass),
(GtkClassInitFunc) gimp_palette_class_init,
(GtkObjectInitFunc) gimp_palette_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_palette_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPalette),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_palette_init,
};
palette_type = gtk_type_unique (GIMP_TYPE_DATA, &palette_info);
palette_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpPalette",
&palette_info, 0);
}
return palette_type;
@ -86,23 +91,23 @@ gimp_palette_get_type (void)
static void
gimp_palette_class_init (GimpPaletteClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_palette_destroy;
object_class->finalize = gimp_palette_finalize;
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -110,14 +115,13 @@ gimp_palette_init (GimpPalette *palette)
{
palette->colors = NULL;
palette->n_colors = 0;
palette->n_columns = 0;
}
static void
gimp_palette_destroy (GtkObject *object)
gimp_palette_finalize (GObject *object)
{
GimpPalette *palette;
GimpPalette *palette;
g_return_if_fail (GIMP_IS_PALETTE (object));
@ -130,8 +134,7 @@ gimp_palette_destroy (GtkObject *object)
palette->colors = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -28,9 +28,10 @@
#define GIMP_TYPE_PALETTE (gimp_palette_get_type ())
#define GIMP_PALETTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PALETTE, GimpPalette))
#define GIMP_IS_PALETTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PALETTE))
#define GIMP_PALETTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PALETTE, GimpPaletteClass))
#define GIMP_IS_PALETTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PALETTE))
#define GIMP_IS_PALETTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PALETTE))
#define GIMP_PALETTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PALETTE, GimpPaletteClass))
typedef struct _GimpPaletteEntry GimpPaletteEntry;

View File

@ -38,7 +38,8 @@ enum
static void gimp_parasite_list_class_init (GimpParasiteListClass *klass);
static void gimp_parasite_list_init (GimpParasiteList *list);
static void gimp_parasite_list_destroy (GtkObject *list);
static void gimp_parasite_list_finalize (GObject *object);
static gint free_a_parasite (gpointer key,
gpointer parasite,
@ -47,38 +48,45 @@ static gint free_a_parasite (gpointer key,
static guint parasite_list_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass *parent_class = NULL;
GType
gimp_parasite_list_get_type (void)
{
static GType type = 0;
static GType list_type = 0;
if (! type)
if (! list_type)
{
GtkTypeInfo info =
static const GTypeInfo list_info =
{
"GimpParasiteList",
sizeof (GimpParasiteListClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_parasite_list_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpParasiteList),
sizeof (GimpParasiteListClass),
(GtkClassInitFunc) gimp_parasite_list_class_init,
(GtkObjectInitFunc) gimp_parasite_list_init,
NULL,
NULL,
(GtkClassInitFunc) NULL
0, /* n_preallocs */
(GInstanceInitFunc) gimp_parasite_list_init,
};
type = gtk_type_unique (GIMP_TYPE_OBJECT, &info);
list_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpParasiteList",
&list_info, 0);
}
return type;
return list_type;
}
static void
gimp_parasite_list_class_init (GimpParasiteListClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
parasite_list_signals[ADD] =
g_signal_new ("add",
@ -100,10 +108,10 @@ gimp_parasite_list_class_init (GimpParasiteListClass *klass)
G_TYPE_NONE, 1,
GTK_TYPE_POINTER);
object_class->destroy = gimp_parasite_list_destroy;
object_class->finalize = gimp_parasite_list_finalize;
klass->add = NULL;
klass->remove = NULL;
klass->add = NULL;
klass->remove = NULL;
}
static void
@ -122,18 +130,8 @@ gimp_parasite_list_new (void)
return list;
}
static gint
free_a_parasite (void *key,
void *parasite,
void *unused)
{
gimp_parasite_free ((GimpParasite *) parasite);
return TRUE;
}
static void
gimp_parasite_list_destroy (GtkObject *object)
gimp_parasite_list_finalize (GObject *object)
{
GimpParasiteList *list;
@ -145,7 +143,20 @@ gimp_parasite_list_destroy (GtkObject *object)
{
g_hash_table_foreach_remove (list->table, free_a_parasite, NULL);
g_hash_table_destroy (list->table);
list->table = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gint
free_a_parasite (void *key,
void *parasite,
void *unused)
{
gimp_parasite_free ((GimpParasite *) parasite);
return TRUE;
}
static void
@ -269,7 +280,7 @@ GimpParasite *
gimp_parasite_list_find (GimpParasiteList *list,
const gchar *name)
{
g_return_val_if_fail (list != NULL, NULL);
g_return_val_if_fail (GIMP_IS_PARASITE_LIST (list), NULL);
if (list->table)
return (GimpParasite *) g_hash_table_lookup (list->table, name);

View File

@ -22,10 +22,12 @@
#include "gimpobject.h"
#define GIMP_TYPE_PARASITE_LIST (gimp_parasite_list_get_type ())
#define GIMP_PARASITE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PARASITE_LIST, GimpParasiteList))
#define GIMP_IS_PARASITE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PARASITE_LIST))
#define PARASITE_LIST_CLASS(class) GIMP_CHECK_CLASS_CAST (class, GIMP_TYPE_PARASITE_LIST, GimpParasiteListClass)
#define GIMP_TYPE_PARASITE_LIST (gimp_parasite_list_get_type ())
#define GIMP_PARASITE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PARASITE_LIST, GimpParasiteList))
#define GIMP_PARASITE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PARASITE_LIST, GimpParasiteListClass))
#define GIMP_IS_PARASITE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PARASITE_LIST))
#define GIMP_IS_PARASITE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PARASITE_LIST))
#define GIMP_PARASITE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PARASITE_LIST, GimpParasiteListClass))
typedef struct _GimpParasiteListClass GimpParasiteListClass;

View File

@ -54,7 +54,9 @@
static void gimp_pattern_class_init (GimpPatternClass *klass);
static void gimp_pattern_init (GimpPattern *pattern);
static void gimp_pattern_destroy (GtkObject *object);
static void gimp_pattern_finalize (GObject *object);
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -72,19 +74,22 @@ gimp_pattern_get_type (void)
if (! pattern_type)
{
static const GtkTypeInfo pattern_info =
static const GTypeInfo pattern_info =
{
"GimpPattern",
sizeof (GimpPattern),
sizeof (GimpPatternClass),
(GtkClassInitFunc) gimp_pattern_class_init,
(GtkObjectInitFunc) gimp_pattern_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_pattern_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPattern),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_pattern_init,
};
pattern_type = gtk_type_unique (GIMP_TYPE_DATA, &pattern_info);
pattern_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpPattern",
&pattern_info, 0);
}
return pattern_type;
@ -93,17 +98,17 @@ gimp_pattern_get_type (void)
static void
gimp_pattern_class_init (GimpPatternClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_pattern_destroy;
object_class->finalize = gimp_pattern_finalize;
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
@ -118,7 +123,7 @@ gimp_pattern_init (GimpPattern *pattern)
}
static void
gimp_pattern_destroy (GtkObject *object)
gimp_pattern_finalize (GObject *object)
{
GimpPattern *pattern;
@ -130,8 +135,7 @@ gimp_pattern_destroy (GtkObject *object)
pattern->mask = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -54,7 +54,9 @@
static void gimp_pattern_class_init (GimpPatternClass *klass);
static void gimp_pattern_init (GimpPattern *pattern);
static void gimp_pattern_destroy (GtkObject *object);
static void gimp_pattern_finalize (GObject *object);
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -72,19 +74,22 @@ gimp_pattern_get_type (void)
if (! pattern_type)
{
static const GtkTypeInfo pattern_info =
static const GTypeInfo pattern_info =
{
"GimpPattern",
sizeof (GimpPattern),
sizeof (GimpPatternClass),
(GtkClassInitFunc) gimp_pattern_class_init,
(GtkObjectInitFunc) gimp_pattern_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_pattern_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPattern),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_pattern_init,
};
pattern_type = gtk_type_unique (GIMP_TYPE_DATA, &pattern_info);
pattern_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpPattern",
&pattern_info, 0);
}
return pattern_type;
@ -93,17 +98,17 @@ gimp_pattern_get_type (void)
static void
gimp_pattern_class_init (GimpPatternClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_pattern_destroy;
object_class->finalize = gimp_pattern_finalize;
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
@ -118,7 +123,7 @@ gimp_pattern_init (GimpPattern *pattern)
}
static void
gimp_pattern_destroy (GtkObject *object)
gimp_pattern_finalize (GObject *object)
{
GimpPattern *pattern;
@ -130,8 +135,7 @@ gimp_pattern_destroy (GtkObject *object)
pattern->mask = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -31,6 +31,7 @@
#define GIMP_PATTERN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATTERN, GimpPatternClass))
#define GIMP_IS_PATTERN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATTERN))
#define GIMP_IS_PATTERN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATTERN))
#define GIMP_PATTERN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATTERN, GimpPatternClass))
typedef struct _GimpPatternClass GimpPatternClass;

View File

@ -458,34 +458,81 @@ gimp_image_destroy (GtkObject *object)
gimage = GIMP_IMAGE (object);
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
if (gimage->gimp && gimage->gimp->image_table)
{
g_hash_table_remove (gimage->gimp->image_table,
GINT_TO_POINTER (gimage->ID));
gimage->gimp = NULL;
}
if (gimage->projection)
gimp_image_free_projection (gimage);
if (gimage->shadow)
gimp_image_free_shadow (gimage);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
g_object_unref (G_OBJECT (gimage->layers));
g_object_unref (G_OBJECT (gimage->channels));
g_slist_free (gimage->layer_stack);
{
g_free (gimage->cmap);
gimage->cmap = NULL;
}
g_object_unref (G_OBJECT (gimage->selection_mask));
if (gimage->layers)
{
g_object_unref (G_OBJECT (gimage->layers));
gimage->layers = NULL;
}
if (gimage->channels)
{
g_object_unref (G_OBJECT (gimage->channels));
gimage->channels = NULL;
}
if (gimage->layer_stack)
{
g_slist_free (gimage->layer_stack);
gimage->layer_stack = NULL;
}
if (gimage->selection_mask)
{
g_object_unref (G_OBJECT (gimage->selection_mask));
gimage->selection_mask = NULL;
}
if (gimage->comp_preview)
temp_buf_free (gimage->comp_preview);
{
temp_buf_free (gimage->comp_preview);
gimage->comp_preview = NULL;
}
if (gimage->parasites)
g_object_unref (G_OBJECT (gimage->parasites));
{
g_object_unref (G_OBJECT (gimage->parasites));
gimage->parasites = NULL;
}
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
if (gimage->guides)
{
g_list_foreach (gimage->guides, (GFunc) g_free, NULL);
g_list_free (gimage->guides);
gimage->guides = NULL;
}
undo_free (gimage);
g_object_unref (G_OBJECT (gimage->new_undo_stack));
g_object_unref (G_OBJECT (gimage->new_redo_stack));
if (gimage->new_undo_stack)
{
g_object_unref (G_OBJECT (gimage->new_undo_stack));
gimage->new_undo_stack = NULL;
}
if (gimage->new_redo_stack)
{
g_object_unref (G_OBJECT (gimage->new_redo_stack));
gimage->new_redo_stack = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -577,10 +624,13 @@ gimp_image_allocate_projection (GimpImage *gimage)
static void
gimp_image_free_projection (GimpImage *gimage)
{
if (gimage->projection)
tile_manager_destroy (gimage->projection);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->projection = NULL;
if (gimage->projection)
{
tile_manager_destroy (gimage->projection);
gimage->projection = NULL;
}
}
static void
@ -605,7 +655,6 @@ gimp_image_new (Gimp *gimp,
GimpImage *gimage;
gint i;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = GIMP_IMAGE (g_object_new (GIMP_TYPE_IMAGE, NULL));
@ -658,7 +707,6 @@ gimp_image_new (Gimp *gimp,
gint
gimp_image_get_ID (GimpImage *gimage)
{
g_return_val_if_fail (gimage != NULL, -1);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), -1);
return gimage->ID;
@ -668,7 +716,6 @@ GimpImage *
gimp_image_get_by_ID (Gimp *gimp,
gint image_id)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->image_table == NULL)
@ -682,6 +729,8 @@ void
gimp_image_set_filename (GimpImage *gimage,
const gchar *filename)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
@ -690,6 +739,8 @@ gimp_image_set_resolution (GimpImage *gimage,
gdouble xresolution,
gdouble yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* nothing to do if setting res to the same as before */
if ((ABS (gimage->xresolution - xresolution) < 1e-5) &&
(ABS (gimage->yresolution - yresolution) < 1e-5))
@ -714,6 +765,7 @@ gimp_image_get_resolution (const GimpImage *gimage,
gdouble *xresolution,
gdouble *yresolution)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (xresolution && yresolution);
*xresolution = gimage->xresolution;
@ -724,6 +776,8 @@ void
gimp_image_set_unit (GimpImage *gimage,
GimpUnit unit)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
undo_push_resolution (gimage);
gimage->unit = unit;
@ -732,6 +786,8 @@ gimp_image_set_unit (GimpImage *gimage,
GimpUnit
gimp_image_get_unit (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_UNIT_INCH);
return gimage->unit;
}
@ -739,24 +795,32 @@ void
gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->save_proc = proc;
}
PlugInProcDef *
gimp_image_get_save_proc (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimage->save_proc;
}
gint
gimp_image_get_width (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->width;
}
gint
gimp_image_get_height (const GimpImage *gimage)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0);
return gimage->height;
}
@ -773,9 +837,10 @@ gimp_image_resize (GimpImage *gimage,
GList *list;
GList *guide_list;
gimp_set_busy (gimage->gimp);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
g_assert (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
@ -879,12 +944,8 @@ gimp_image_scale (GimpImage *gimage,
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
if ((new_width == 0) || (new_height == 0))
{
g_message ("%s(): Scaling to zero width or height has been rejected.",
G_GNUC_FUNCTION);
return;
}
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
gimp_set_busy (gimage->gimp);
@ -1009,7 +1070,6 @@ gimp_image_check_scaling (const GimpImage *gimage,
{
GList *list;
g_return_val_if_fail (gimage != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
@ -1033,6 +1093,8 @@ gimp_image_shadow (GimpImage *gimage,
gint height,
gint bpp)
{
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
if (gimage->shadow &&
((width != tile_manager_width (gimage->shadow)) ||
(height != tile_manager_height (gimage->shadow)) ||
@ -1049,11 +1111,13 @@ gimp_image_shadow (GimpImage *gimage,
void
gimp_image_free_shadow (GimpImage *gimage)
{
/* Free the shadow buffer from the specified gimage if it exists */
if (gimage->shadow)
tile_manager_destroy (gimage->shadow);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimage->shadow = NULL;
if (gimage->shadow)
{
tile_manager_destroy (gimage->shadow);
gimage->shadow = NULL;
}
}
void
@ -1075,6 +1139,8 @@ gimp_image_apply_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1182,6 +1248,8 @@ gimp_image_replace_image (GimpImage *gimage,
gint operation;
gint active [MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* get the selection mask if one exists */
mask = (gimage_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
@ -1299,6 +1367,10 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (fg != NULL);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1314,7 +1386,10 @@ gimp_image_get_background (const GimpImage *gimage,
GimpRGB color;
guchar pbg[3];
/* Get the palette color */
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (bg != NULL);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -167,7 +167,7 @@ struct _GimpImageClass
/* function declarations */
GtkType gimp_image_get_type (void);
GType gimp_image_get_type (void);
GimpImage * gimp_image_new (Gimp *gimp,
gint width,

View File

@ -37,7 +37,8 @@
static void gimp_tool_info_class_init (GimpToolInfoClass *klass);
static void gimp_tool_info_init (GimpToolInfo *tool_info);
static void gimp_tool_info_destroy (GtkObject *object);
static void gimp_tool_info_finalize (GObject *object);
static TempBuf * gimp_tool_info_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
@ -46,26 +47,29 @@ static TempBuf * gimp_tool_info_get_new_preview (GimpViewable *viewable,
static GimpDataClass *parent_class = NULL;
GtkType
GType
gimp_tool_info_get_type (void)
{
static GtkType tool_info_type = 0;
static GType tool_info_type = 0;
if (! tool_info_type)
{
GtkTypeInfo tool_info_info =
static const GTypeInfo tool_info_info =
{
"GimpToolInfo",
sizeof (GimpToolInfo),
sizeof (GimpToolInfoClass),
(GtkClassInitFunc) gimp_tool_info_class_init,
(GtkObjectInitFunc) gimp_tool_info_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_tool_info_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpToolInfo),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_tool_info_init,
};
tool_info_type = gtk_type_unique (GIMP_TYPE_DATA, &tool_info_info);
tool_info_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpToolInfo",
&tool_info_info, 0);
}
return tool_info_type;
@ -74,15 +78,15 @@ gimp_tool_info_get_type (void)
static void
gimp_tool_info_class_init (GimpToolInfoClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_tool_info_destroy;
object_class->finalize = gimp_tool_info_finalize;
viewable_class->get_new_preview = gimp_tool_info_get_new_preview;
}
@ -110,20 +114,44 @@ gimp_tool_info_init (GimpToolInfo *tool_info)
}
static void
gimp_tool_info_destroy (GtkObject *object)
gimp_tool_info_finalize (GObject *object)
{
GimpToolInfo *tool_info;
tool_info = (GimpToolInfo *) object;
g_free (tool_info->blurb);
g_free (tool_info->help);
if (tool_info->blurb)
{
g_free (tool_info->blurb);
tool_info->blurb = NULL;
}
if (tool_info->help)
{
g_free (tool_info->help);
tool_info->blurb = NULL;
}
g_free (tool_info->menu_path);
g_free (tool_info->menu_accel);
if (tool_info->menu_path)
{
g_free (tool_info->menu_path);
tool_info->menu_path = NULL;
}
if (tool_info->menu_accel)
{
g_free (tool_info->menu_accel);
tool_info->menu_accel = NULL;
}
g_free (tool_info->help_domain);
g_free (tool_info->help_data);
if (tool_info->help_domain)
{
g_free (tool_info->help_domain);
tool_info->help_domain = NULL;
}
if (tool_info->help_data)
{
g_free (tool_info->help_data);
tool_info->help_data = NULL;
}
if (tool_info->stock_pixbuf)
{
@ -131,8 +159,7 @@ gimp_tool_info_destroy (GtkObject *object)
tool_info->stock_pixbuf = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static TempBuf *

View File

@ -25,9 +25,10 @@
#define GIMP_TYPE_TOOL_INFO (gimp_tool_info_get_type ())
#define GIMP_TOOL_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TOOL_INFO, GimpToolInfo))
#define GIMP_IS_TOOL_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TOOL_INFO))
#define GIMP_TOOL_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL_INFO, GimpToolInfoClass))
#define GIMP_IS_TOOL_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TOOL_INFO))
#define GIMP_IS_TOOL_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL_INFO))
#define GIMP_TOOL_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TOOL_INFO, GimpToolInfoClass))
typedef struct _GimpToolInfoClass GimpToolInfoClass;
@ -37,7 +38,7 @@ struct _GimpToolInfo
{
GimpData parent_instance;
GtkType tool_type;
GType tool_type;
gchar *blurb;
gchar *help;
@ -64,10 +65,10 @@ struct _GimpToolInfoClass
};
GtkType gimp_tool_info_get_type (void);
GType gimp_tool_info_get_type (void);
GimpToolInfo * gimp_tool_info_new (GimpContext *context,
GtkType tool_type,
GType tool_type,
gboolean tool_context,
const gchar *identifier,
const gchar *blurb,

View File

@ -38,7 +38,9 @@ enum
static void gimp_undo_class_init (GimpUndoClass *klass);
static void gimp_undo_init (GimpUndo *undo);
static void gimp_undo_destroy (GtkObject *object);
static void gimp_undo_finalize (GObject *object);
static void gimp_undo_real_push (GimpUndo *undo,
GimpImage *gimage);
static void gimp_undo_real_pop (GimpUndo *undo,
@ -60,19 +62,22 @@ gimp_undo_get_type (void)
if (! undo_type)
{
static const GtkTypeInfo undo_info =
static const GTypeInfo undo_info =
{
"GimpUndo",
sizeof (GimpUndo),
sizeof (GimpUndoClass),
(GtkClassInitFunc) gimp_undo_class_init,
(GtkObjectInitFunc) gimp_undo_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_undo_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpUndo),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_undo_init,
};
undo_type = gtk_type_unique (GIMP_TYPE_VIEWABLE, &undo_info);
undo_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpUndo",
&undo_info, 0);
}
return undo_type;
@ -81,11 +86,11 @@ gimp_undo_get_type (void)
static void
gimp_undo_class_init (GimpUndoClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GObjectClass *object_class;
GimpViewableClass *viewable_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
object_class = G_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -109,8 +114,8 @@ gimp_undo_class_init (GimpUndoClass *klass)
G_TYPE_NONE, 1,
G_TYPE_POINTER);
object_class->destroy = gimp_undo_destroy;
object_class->finalize = gimp_undo_finalize;
viewable_class->get_preview = gimp_undo_get_preview;
klass->push = gimp_undo_real_push;
@ -129,7 +134,7 @@ gimp_undo_init (GimpUndo *undo)
}
static void
gimp_undo_destroy (GtkObject *object)
gimp_undo_finalize (GObject *object)
{
GimpUndo *undo;
@ -147,8 +152,7 @@ gimp_undo_destroy (GtkObject *object)
undo->preview = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GimpUndo *
@ -161,7 +165,7 @@ gimp_undo_new (const gchar *name,
{
GimpUndo *undo;
undo = GIMP_UNDO (gtk_object_new (GIMP_TYPE_UNDO, NULL));
undo = GIMP_UNDO (g_object_new (GIMP_TYPE_UNDO, NULL));
gimp_object_set_name (GIMP_OBJECT (undo), name);

View File

@ -28,6 +28,7 @@
#define GIMP_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_UNDO, GimpUndoClass))
#define GIMP_IS_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_UNDO))
#define GIMP_IS_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_UNDO))
#define GIMP_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_UNDO, GimpUndoClass))
typedef gboolean (* GimpUndoPopFunc) (GimpUndo *undo, GimpImage *gimage);

View File

@ -28,9 +28,10 @@
#include "gimpundostack.h"
static void gimp_undo_stack_class_init (GimpUndoStackClass *klass);
static void gimp_undo_stack_init (GimpUndoStack *stack);
static void gimp_undo_stack_destroy (GtkObject *object);
static void gimp_undo_stack_class_init (GimpUndoStackClass *klass);
static void gimp_undo_stack_init (GimpUndoStack *stack);
static void gimp_undo_stack_finalize (GObject *object);
static void gimp_undo_stack_add_callback (GimpContainer *container,
GimpObject *object,
@ -50,20 +51,22 @@ gimp_undo_stack_get_type (void)
if (! undo_stack_type)
{
static const GtkTypeInfo undo_stack_info =
static const GTypeInfo undo_stack_info =
{
"GimpUndoStack",
sizeof (GimpUndoStack),
sizeof (GimpUndoStackClass),
(GtkClassInitFunc) gimp_undo_stack_class_init,
(GtkObjectInitFunc) gimp_undo_stack_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_undo_stack_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpUndoStack),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_undo_stack_init,
};
undo_stack_type = gtk_type_unique (GIMP_TYPE_UNDO,
&undo_stack_info);
undo_stack_type = g_type_register_static (GIMP_TYPE_UNDO,
"GimpUndoStack",
&undo_stack_info, 0);
}
return undo_stack_type;
@ -72,13 +75,13 @@ gimp_undo_stack_get_type (void)
static void
gimp_undo_stack_class_init (GimpUndoStackClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_undo_stack_destroy;
object_class->finalize = gimp_undo_stack_finalize;
}
static void
@ -104,7 +107,7 @@ gimp_undo_stack_init (GimpUndoStack *stack)
}
static void
gimp_undo_stack_destroy (GtkObject *object)
gimp_undo_stack_finalize (GObject *object)
{
GimpUndoStack *stack;
@ -116,8 +119,7 @@ gimp_undo_stack_destroy (GtkObject *object)
stack->undos = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GimpUndoStack *

View File

@ -28,6 +28,7 @@
#define GIMP_UNDO_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_UNDO_STACK, GimpUndoStackClass))
#define GIMP_IS_UNDO_STACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_UNDO_STACK))
#define GIMP_IS_UNDO_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_UNDO_STACK))
#define GIMP_UNDO_STACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_UNDO_STACK, GimpUndoStackClass))
typedef struct _GimpUndoStackClass GimpUndoStackClass;
@ -47,7 +48,9 @@ struct _GimpUndoStackClass
GType gimp_undo_stack_get_type (void);
GimpUndoStack * gimp_undo_stack_new (GimpImage *gimage);
void gimp_undo_stack_push (GimpUndoStack *stack,
GimpUndo *undo);
GimpUndo * gimp_undo_stack_pop (GimpUndoStack *stack);

View File

@ -61,6 +61,7 @@
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdocuments.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"

View File

@ -61,6 +61,7 @@
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdocuments.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"