Commit 619c9a94 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/vectors/Makefile.am new files creating dummy vectors previews.

2002-02-25  Michael Natterer  <mitch@gimp.org>

	* app/vectors/Makefile.am
	* app/vectors/gimpvectors-preview.[ch]: new files creating dummy
	vectors previews.

	* app/vectors/gimpvectors.[ch]: added a "gimage" pointer.

	* app/vectors/gimpbezierstroke.c
	* app/vectors/gimpstroke.c: some object stuff fixes.
parent 0f2f97de
2002-02-25 Michael Natterer <mitch@gimp.org>
* app/vectors/Makefile.am
* app/vectors/gimpvectors-preview.[ch]: new files creating dummy
vectors previews.
* app/vectors/gimpvectors.[ch]: added a "gimage" pointer.
* app/vectors/gimpbezierstroke.c
* app/vectors/gimpstroke.c: some object stuff fixes.
2002-02-25 Sven Neumann <sven@gimp.org>
* po-libgimp/Makefile.in.in
......
......@@ -23,6 +23,8 @@ libappvectors_a_sources = @STRIP_BEGIN@ \
gimpstroke.c \
gimpvectors.c \
gimpvectors.h \
gimpvectors-preview.c \
gimpvectors-preview.h \
@STRIP_END@
libappvectors_a_SOURCES = $(libappvectors_a_sources)
......
......@@ -34,30 +34,13 @@
/* private variables */
static GObjectClass *parent_class = NULL;
static GimpStrokeClass *parent_class = NULL;
static void gimp_bezier_stroke_init (GimpBezierStroke *bezier_stroke);
static void gimp_bezier_stroke_class_init (GimpStrokeClass *klass);
static void gimp_bezier_stroke_init (GimpBezierStroke *bezier_stroke);
static void
gimp_bezier_stroke_finalize (GObject *object)
{
/* blablabla */
}
static void
gimp_bezier_stroke_class_init (GimpStrokeClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_bezier_stroke_finalize;
}
static void gimp_bezier_stroke_finalize (GObject *object);
GType
......@@ -88,6 +71,17 @@ gimp_bezier_stroke_get_type (void)
return bezier_stroke_type;
}
static void
gimp_bezier_stroke_class_init (GimpStrokeClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_bezier_stroke_finalize;
}
static void
gimp_bezier_stroke_init (GimpBezierStroke *bezier_stroke)
......@@ -95,6 +89,12 @@ gimp_bezier_stroke_init (GimpBezierStroke *bezier_stroke)
/* pass */
};
static void
gimp_bezier_stroke_finalize (GObject *object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* Bezier specific functions */
......@@ -108,7 +108,6 @@ gimp_bezier_stroke_new (const GimpCoords *start)
bezier_stroke = g_object_new (GIMP_TYPE_BEZIER_STROKE, NULL);
stroke = GIMP_STROKE (bezier_stroke);
stroke->anchors = NULL;
anchor = g_new0 (GimpAnchor, 1);
anchor->position.x = start->x;
......
......@@ -38,8 +38,11 @@ static GObjectClass *parent_class = NULL;
/* Prototypes */
static void gimp_stroke_class_init (GimpStrokeClass *klass);
static void gimp_stroke_init (GimpStroke *stroke);
static void gimp_stroke_finalize (GObject *object);
static GimpAnchor * gimp_stroke_real_anchor_get (const GimpStroke *stroke,
const GimpCoords *coord);
static GimpAnchor * gimp_stroke_real_anchor_get_next (const GimpStroke *stroke,
......@@ -54,12 +57,33 @@ static void gimp_stroke_real_anchor_move_absolute (GimpStroke *stroke,
const gint type);
static void
gimp_stroke_finalize (GObject *object)
GType
gimp_stroke_get_type (void)
{
/* blablabla */
}
static GType stroke_type = 0;
if (! stroke_type)
{
static const GTypeInfo stroke_info =
{
sizeof (GimpStrokeClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_stroke_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpStroke),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_stroke_init,
};
stroke_type = g_type_register_static (G_TYPE_OBJECT,
"GimpStroke",
&stroke_info, 0);
}
return stroke_type;
}
static void
gimp_stroke_class_init (GimpStrokeClass *klass)
......@@ -92,42 +116,17 @@ gimp_stroke_class_init (GimpStrokeClass *klass)
klass->make_bezier = NULL;
}
GType
gimp_stroke_get_type (void)
{
static GType stroke_type = 0;
if (! stroke_type)
{
static const GTypeInfo stroke_info =
{
sizeof (GimpStrokeClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_stroke_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpStroke),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_stroke_init,
};
stroke_type = g_type_register_static (G_TYPE_OBJECT,
"GimpStroke",
&stroke_info, 0);
}
return stroke_type;
}
static void
gimp_stroke_init (GimpStroke *stroke)
{
stroke->anchors = NULL;
stroke->anchors = NULL;
};
static void
gimp_stroke_finalize (GObject *object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* Calling the virtual functions */
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <glib-object.h>
#include "vectors-types.h"
#include "base/temp-buf.h"
#include "gimpvectors.h"
#include "gimpvectors-preview.h"
/* public functions */
TempBuf *
gimp_vectors_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
{
GimpVectors *vectors;
TempBuf *temp_buf;
guchar white[1] = { 255 };
vectors = GIMP_VECTORS (viewable);
temp_buf = temp_buf_new (width, height, 1, 0, 0, white);
return temp_buf;
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_VECTORS__PREVIEW_H__
#define __GIMP_VECTORS__PREVIEW_H__
/*
* virtual function of GimpVectors -- dont't call directly
*/
TempBuf * gimp_vectors_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
#endif /* __GIMP_VECTORS__PREVIEW_H__ */
......@@ -26,10 +26,12 @@
#include "vectors-types.h"
#include "core/gimpimage.h"
#include "gimpanchor.h"
#include "gimpstroke.h"
#include "gimpvectors.h"
#include "gimpvectors-preview.h"
/* private variables */
......@@ -38,14 +40,39 @@
static GimpViewableClass *parent_class = NULL;
static void gimp_vectors_init (GimpVectors *vectors);
static void gimp_vectors_class_init (GimpVectorsClass *klass);
static void gimp_vectors_init (GimpVectors *vectors);
static void
gimp_vectors_finalize (GObject *object)
static void gimp_vectors_finalize (GObject *object);
GType
gimp_vectors_get_type (void)
{
/* blablabla */
}
static GType vectors_type = 0;
if (! vectors_type)
{
static const GTypeInfo vectors_info =
{
sizeof (GimpVectorsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_vectors_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpVectors),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_vectors_init,
};
vectors_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpVectors",
&vectors_info, 0);
}
return vectors_type;
}
static void
gimp_vectors_class_init (GimpVectorsClass *klass)
......@@ -64,6 +91,8 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
/* gimp_object_class->name_changed = gimp_vectors_name_changed; */
viewable_class->get_new_preview = gimp_vectors_get_new_preview;
klass->changed = NULL;
klass->removed = NULL;
......@@ -88,41 +117,36 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
klass->make_bezier = NULL;
}
GType
gimp_vectors_get_type (void)
static void
gimp_vectors_init (GimpVectors *vectors)
{
static GType vectors_type = 0;
vectors->gimage = NULL;
vectors->strokes = NULL;
};
if (! vectors_type)
{
static const GTypeInfo vectors_info =
{
sizeof (GimpVectorsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_vectors_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpVectors),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_vectors_init,
};
static void
gimp_vectors_finalize (GObject *object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
}
vectors_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
"GimpVectors",
&vectors_info, 0);
}
void
gimp_vectors_set_image (GimpVectors *vectors,
GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_VECTORS (vectors));
g_return_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage));
return vectors_type;
vectors->gimage = gimage;
}
static void
gimp_vectors_init (GimpVectors *vectors)
GimpImage *
gimp_vectors_get_image (const GimpVectors *vectors)
{
vectors->strokes = NULL;
};
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
return vectors->gimage;
}
/* Calling the virtual functions */
......@@ -145,9 +169,8 @@ gimp_vectors_anchor_get (const GimpVectors *vectors,
GimpAnchor *anchor = NULL, *minanchor = NULL;
mindist = -1;
list = vectors->strokes;
while (list)
for (list = vectors->strokes; list; list = g_list_next (list))
{
anchor = gimp_stroke_anchor_get (GIMP_STROKE (list->data), coord);
if (anchor)
......@@ -160,7 +183,6 @@ gimp_vectors_anchor_get (const GimpVectors *vectors,
minanchor = anchor;
}
}
list = list->next;
}
return minanchor;
}
......
......@@ -37,6 +37,8 @@ struct _GimpVectors
{
GimpViewable parent_instance;
GimpImage * gimage;
gboolean visible; /* controls visibility */
gboolean locked; /* transformation locking */
......@@ -112,6 +114,10 @@ struct _GimpVectorsClass
GType gimp_vectors_get_type (void) G_GNUC_CONST;
void gimp_vectors_set_image (GimpVectors *vectors,
GimpImage *gimage);
GimpImage * gimp_vectors_get_image (const GimpVectors *vectors);
/* accessing / modifying the anchors */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment