diff options
author | Benjamin Otte <otte@redhat.com> | 2010-10-13 23:20:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:49:59 +0800 |
commit | c90e014d6156ac43c515f7e37b15a57237338e3e (patch) | |
tree | 0b9434763593af54922d2650ba1166a6566a4b16 /libgnomecanvas | |
parent | e5cf725c52f786e3025e9e7455f3a34bf30fe446 (diff) | |
download | gsoc2013-evolution-c90e014d6156ac43c515f7e37b15a57237338e3e.tar.gz gsoc2013-evolution-c90e014d6156ac43c515f7e37b15a57237338e3e.tar.zst gsoc2013-evolution-c90e014d6156ac43c515f7e37b15a57237338e3e.zip |
gnome-canvas: Remove GnomeCanvasPolygon
It's unused and has an ugly API. We can redo it later if we need it.
Diffstat (limited to 'libgnomecanvas')
-rw-r--r-- | libgnomecanvas/Makefile.am | 2 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas-polygon.c | 236 | ||||
-rw-r--r-- | libgnomecanvas/gnome-canvas-polygon.h | 84 | ||||
-rw-r--r-- | libgnomecanvas/libgnomecanvas.h | 1 |
4 files changed, 0 insertions, 323 deletions
diff --git a/libgnomecanvas/Makefile.am b/libgnomecanvas/Makefile.am index a69cbb989d..5069052309 100644 --- a/libgnomecanvas/Makefile.am +++ b/libgnomecanvas/Makefile.am @@ -28,7 +28,6 @@ libgnomecanvasinclude_HEADERS = \ gnome-canvas-line.h \ gnome-canvas-path-def.h \ gnome-canvas-pixbuf.h \ - gnome-canvas-polygon.h \ gnome-canvas-rect-ellipse.h \ gnome-canvas-rich-text.h \ gnome-canvas-shape.h \ @@ -52,7 +51,6 @@ libgnomecanvas_la_SOURCES = \ gnome-canvas-line.c \ gnome-canvas-path-def.c \ gnome-canvas-pixbuf.c \ - gnome-canvas-polygon.c \ gnome-canvas-rect-ellipse.c \ gnome-canvas-rich-text.c \ gnome-canvas-shape-private.h \ diff --git a/libgnomecanvas/gnome-canvas-polygon.c b/libgnomecanvas/gnome-canvas-polygon.c deleted file mode 100644 index 90ae40fe5e..0000000000 --- a/libgnomecanvas/gnome-canvas-polygon.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation - * All rights reserved. - * - * This file is part of the Gnome Library. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - @NOTATION@ - */ -/* Polygon item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is - * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. - * - * Author: Federico Mena <federico@nuclecu.unam.mx> - * Rusty Conover <rconover@bangtail.net> - */ - -#include <config.h> -#include <math.h> -#include <string.h> -#include <libart_lgpl/art_vpath.h> -#include <libart_lgpl/art_svp.h> -#include <libart_lgpl/art_svp_vpath.h> -#include <libart_lgpl/art_svp_vpath_stroke.h> -#include "libgnomecanvas.h" - -#include "gnome-canvas-shape.h" - -#define NUM_STATIC_POINTS 256 /* Number of static points to use to avoid allocating arrays */ - -enum { - PROP_0, - PROP_POINTS -}; - -static void gnome_canvas_polygon_class_init (GnomeCanvasPolygonClass *class); -static void gnome_canvas_polygon_init (GnomeCanvasPolygon *poly); -static void gnome_canvas_polygon_destroy (GnomeCanvasItem *object); -static void gnome_canvas_polygon_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec); -static void gnome_canvas_polygon_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec); - -static void gnome_canvas_polygon_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags); - -static GnomeCanvasItemClass *parent_class; - -GType -gnome_canvas_polygon_get_type (void) -{ - static GType polygon_type; - - if (!polygon_type) { - const GTypeInfo object_info = { - sizeof (GnomeCanvasPolygonClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gnome_canvas_polygon_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GnomeCanvasPolygon), - 0, /* n_preallocs */ - (GInstanceInitFunc) gnome_canvas_polygon_init, - NULL /* value_table */ - }; - - polygon_type = g_type_register_static (GNOME_TYPE_CANVAS_SHAPE, "GnomeCanvasPolygon", - &object_info, 0); - } - - return polygon_type; -} - -static void -gnome_canvas_polygon_class_init (GnomeCanvasPolygonClass *class) -{ - GObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GObjectClass *) class; - item_class = (GnomeCanvasItemClass *) class; - - parent_class = g_type_class_peek_parent (class); - - object_class->set_property = gnome_canvas_polygon_set_property; - object_class->get_property = gnome_canvas_polygon_get_property; - - g_object_class_install_property - (object_class, - PROP_POINTS, - g_param_spec_boxed ("points", NULL, NULL, - GNOME_TYPE_CANVAS_POINTS, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - item_class->destroy = gnome_canvas_polygon_destroy; - item_class->update = gnome_canvas_polygon_update; -} - -static void -gnome_canvas_polygon_init (GnomeCanvasPolygon *poly) -{ - poly->path_def = NULL; -} - -static void -gnome_canvas_polygon_destroy (GnomeCanvasItem *object) -{ - GnomeCanvasPolygon *poly; - - g_return_if_fail (object != NULL); - g_return_if_fail (GNOME_IS_CANVAS_POLYGON (object)); - - poly = GNOME_CANVAS_POLYGON (object); - - /* remember, destroy can be run multiple times! */ - - if (poly->path_def) - gnome_canvas_path_def_unref (poly->path_def); - - poly->path_def = NULL; - - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy) - GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object); -} - -static void -set_points (GnomeCanvasPolygon *poly, GnomeCanvasPoints *points) -{ - gint i; - - if (poly->path_def) - gnome_canvas_path_def_unref (poly->path_def); - - if (!points) { - poly->path_def = gnome_canvas_path_def_new (); - gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (poly), poly->path_def); - return; - } - - /* Optomize the path def to the number of points */ - poly->path_def = gnome_canvas_path_def_new_sized (points->num_points+1); - -#if 0 - /* No need for explicit duplicate, as closepaths does it for us (Lauris) */ - /* See if we need to duplicate the first point */ - duplicate = ((points->coords[0] != points->coords[2 * points->num_points - 2]) - || (points->coords[1] != points->coords[2 * points->num_points - 1])); -#endif - - gnome_canvas_path_def_moveto (poly->path_def, points->coords[0], points->coords[1]); - - for (i = 1; i < points->num_points; i++) { - gnome_canvas_path_def_lineto (poly->path_def, points->coords[i * 2], points->coords[(i * 2) + 1]); - } - - gnome_canvas_path_def_closepath (poly->path_def); - - gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (poly), poly->path_def); -} - -static void -gnome_canvas_polygon_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) -{ - GnomeCanvasItem *item; - GnomeCanvasPolygon *poly; - GnomeCanvasPoints *points; - - g_return_if_fail (object != NULL); - g_return_if_fail (GNOME_IS_CANVAS_POLYGON (object)); - - item = GNOME_CANVAS_ITEM (object); - poly = GNOME_CANVAS_POLYGON (object); - - switch (param_id) { - case PROP_POINTS: - points = g_value_get_boxed (value); - - set_points (poly, points); - - gnome_canvas_item_request_update (item); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} - -static void -gnome_canvas_polygon_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) -{ - g_return_if_fail (object != NULL); - g_return_if_fail (GNOME_IS_CANVAS_POLYGON (object)); - - switch (param_id) { - case PROP_POINTS: - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } -} - -static void -gnome_canvas_polygon_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags) -{ - /* Since the path has already been defined just pass the update up. */ - - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); -} diff --git a/libgnomecanvas/gnome-canvas-polygon.h b/libgnomecanvas/gnome-canvas-polygon.h deleted file mode 100644 index 36233aedc9..0000000000 --- a/libgnomecanvas/gnome-canvas-polygon.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation - * All rights reserved. - * - * This file is part of the Gnome Library. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - @NOTATION@ - */ -/* Polygon item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is - * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. - * - * - * Author: Federico Mena <federico@nuclecu.unam.mx> - * Rusty Conover <rconover@bangtail.net> - */ - -#ifndef GNOME_CANVAS_POLYGON_H -#define GNOME_CANVAS_POLYGON_H - -#include <libgnomecanvas/gnome-canvas.h> -#include <libgnomecanvas/gnome-canvas-shape.h> -#include <libgnomecanvas/gnome-canvas-path-def.h> - -G_BEGIN_DECLS - -/* Polygon item for the canvas. A polygon is a bit different from rectangles and ellipses in that - * points inside it will always be considered "inside", even if the fill color is not set. If you - * want to have a hollow polygon, use a line item instead. - * - * The following object arguments are available: - * - * name type read/write description - * ------------------------------------------------------------------------------------------ - * points GnomeCanvasPoints* RW Pointer to a GnomeCanvasPoints structure. - * This can be created by a call to - * gnome_canvas_points_new() (in gnome-canvas-util.h). - * X coordinates are in the even indices of the - * points->coords array, Y coordinates are in - * the odd indices. - */ - -#define GNOME_TYPE_CANVAS_POLYGON (gnome_canvas_polygon_get_type ()) -#define GNOME_CANVAS_POLYGON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_POLYGON, GnomeCanvasPolygon)) -#define GNOME_CANVAS_POLYGON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_POLYGON, GnomeCanvasPolygonClass)) -#define GNOME_IS_CANVAS_POLYGON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_POLYGON)) -#define GNOME_IS_CANVAS_POLYGON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_POLYGON)) -#define GNOME_CANVAS_POLYGON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_POLYGON, GnomeCanvasPolygonClass)) - -typedef struct _GnomeCanvasPolygon GnomeCanvasPolygon; -typedef struct _GnomeCanvasPolygonClass GnomeCanvasPolygonClass; - -struct _GnomeCanvasPolygon { - GnomeCanvasShape item; - - GnomeCanvasPathDef *path_def; -}; - -struct _GnomeCanvasPolygonClass { - GnomeCanvasShapeClass parent_class; -}; - -/* Standard Gtk function */ -GType gnome_canvas_polygon_get_type (void) G_GNUC_CONST; - -G_END_DECLS -#endif diff --git a/libgnomecanvas/libgnomecanvas.h b/libgnomecanvas/libgnomecanvas.h index e83d9060e6..8ddd2c541e 100644 --- a/libgnomecanvas/libgnomecanvas.h +++ b/libgnomecanvas/libgnomecanvas.h @@ -30,7 +30,6 @@ #include <libgnomecanvas/gnome-canvas-line.h> #include <libgnomecanvas/gnome-canvas-text.h> #include <libgnomecanvas/gnome-canvas-rich-text.h> -#include <libgnomecanvas/gnome-canvas-polygon.h> #include <libgnomecanvas/gnome-canvas-pixbuf.h> #include <libgnomecanvas/gnome-canvas-widget.h> #include <libgnomecanvas/gnome-canvas-rect-ellipse.h> |