mirror of https://github.com/GNOME/gimp.git
made "changed" a real signal, don't crash when iterating a NULL stroke
2003-04-14 Michael Natterer <mitch@gimp.org> * app/vectors/gimpvectors.[ch]: made "changed" a real signal, don't crash when iterating a NULL stroke list, cleanup.
This commit is contained in:
parent
dfdb1917cd
commit
8c6159c41d
|
@ -1,3 +1,8 @@
|
|||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/vectors/gimpvectors.[ch]: made "changed" a real signal,
|
||||
don't crash when iterating a NULL stroke list, cleanup.
|
||||
|
||||
2003-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpdockbook.c (gimp_dockbook_get_tab_widget): check
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "vectors-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
|
||||
#include "gimpanchor.h"
|
||||
#include "gimpstroke.h"
|
||||
|
@ -35,6 +36,13 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
||||
static void gimp_vectors_class_init (GimpVectorsClass *klass);
|
||||
static void gimp_vectors_init (GimpVectors *vectors);
|
||||
|
||||
|
@ -49,6 +57,8 @@ static GimpItem * gimp_vectors_duplicate (GimpItem *item,
|
|||
|
||||
/* private variables */
|
||||
|
||||
static guint gimp_vectors_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GimpItemClass *parent_class = NULL;
|
||||
|
||||
|
||||
|
@ -96,6 +106,15 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gimp_vectors_signals[CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpVectorsClass, changed),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->finalize = gimp_vectors_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_vectors_get_memsize;
|
||||
|
@ -145,14 +164,14 @@ static gsize
|
|||
gimp_vectors_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpVectors *vectors;
|
||||
GList *stroke;
|
||||
GList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
vectors = GIMP_VECTORS (object);
|
||||
|
||||
for (stroke = vectors->strokes; stroke; stroke = stroke->next)
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (stroke->data))
|
||||
+ sizeof (GList);
|
||||
for (list = vectors->strokes; list; list = g_list_next (list))
|
||||
memsize += (gimp_object_get_memsize (GIMP_OBJECT (list->data)) +
|
||||
sizeof (GList));
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
@ -180,7 +199,7 @@ gimp_vectors_duplicate (GimpItem *item,
|
|||
|
||||
gimp_vectors_copy_strokes (vectors, new_vectors);
|
||||
|
||||
return new_item;;
|
||||
return new_item;
|
||||
}
|
||||
|
||||
|
||||
|
@ -352,7 +371,7 @@ gimp_vectors_stroke_get_next (const GimpVectors *vectors,
|
|||
{
|
||||
if (!prev)
|
||||
{
|
||||
return vectors->strokes->data;
|
||||
return vectors->strokes ? vectors->strokes->data : NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -35,13 +35,12 @@
|
|||
|
||||
struct _GimpVectors
|
||||
{
|
||||
GimpItem parent_instance;
|
||||
GimpItem parent_instance;
|
||||
|
||||
gboolean visible; /* controls visibility */
|
||||
gboolean locked; /* transformation locking */
|
||||
gboolean visible; /* controls visibility */
|
||||
gboolean locked; /* transformation locking */
|
||||
|
||||
/* Should the following be a GList of GimpStrokes? */
|
||||
GList * strokes; /* The List of GimpStrokes */
|
||||
GList *strokes; /* The List of GimpStrokes */
|
||||
|
||||
/* Stuff missing */
|
||||
};
|
||||
|
@ -51,41 +50,33 @@ struct _GimpVectorsClass
|
|||
{
|
||||
GimpItemClass parent_class;
|
||||
|
||||
void (* changed) (GimpVectors *vectors);
|
||||
|
||||
void (* stroke_add) (GimpVectors *vectors,
|
||||
const GimpStroke *stroke);
|
||||
|
||||
GimpStroke * (* stroke_get) (const GimpVectors *vectors,
|
||||
const GimpCoords *coord);
|
||||
|
||||
GimpStroke * (* stroke_get_next) (const GimpVectors *vectors,
|
||||
const GimpStroke *prev);
|
||||
|
||||
gdouble (* stroke_get_length) (const GimpVectors *vectors,
|
||||
const GimpStroke *stroke);
|
||||
|
||||
GimpAnchor * (* anchor_get) (const GimpVectors *vectors,
|
||||
const GimpCoords *coord,
|
||||
GimpStroke **ret_stroke);
|
||||
|
||||
void (* anchor_delete) (GimpVectors *vectors,
|
||||
GimpAnchor *anchor);
|
||||
|
||||
gdouble (* get_length) (const GimpVectors *vectors,
|
||||
const GimpAnchor *start);
|
||||
|
||||
gdouble (* get_distance) (const GimpVectors *vectors,
|
||||
const GimpCoords *coord);
|
||||
|
||||
gint (* interpolate) (const GimpVectors *vectors,
|
||||
const GimpStroke *stroke,
|
||||
const gdouble precision,
|
||||
const gint max_points,
|
||||
GimpCoords *ret_coords);
|
||||
|
||||
GimpVectors * (* make_bezier) (const GimpVectors *vectors);
|
||||
/* signals */
|
||||
void (* changed) (GimpVectors *vectors);
|
||||
|
||||
/* virtual functions */
|
||||
void (* stroke_add) (GimpVectors *vectors,
|
||||
const GimpStroke *stroke);
|
||||
GimpStroke * (* stroke_get) (const GimpVectors *vectors,
|
||||
const GimpCoords *coord);
|
||||
GimpStroke * (* stroke_get_next) (const GimpVectors *vectors,
|
||||
const GimpStroke *prev);
|
||||
gdouble (* stroke_get_length) (const GimpVectors *vectors,
|
||||
const GimpStroke *stroke);
|
||||
GimpAnchor * (* anchor_get) (const GimpVectors *vectors,
|
||||
const GimpCoords *coord,
|
||||
GimpStroke **ret_stroke);
|
||||
void (* anchor_delete) (GimpVectors *vectors,
|
||||
GimpAnchor *anchor);
|
||||
gdouble (* get_length) (const GimpVectors *vectors,
|
||||
const GimpAnchor *start);
|
||||
gdouble (* get_distance) (const GimpVectors *vectors,
|
||||
const GimpCoords *coord);
|
||||
gint (* interpolate) (const GimpVectors *vectors,
|
||||
const GimpStroke *stroke,
|
||||
const gdouble precision,
|
||||
const gint max_points,
|
||||
GimpCoords *ret_coords);
|
||||
GimpVectors * (* make_bezier) (const GimpVectors *vectors);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue