From e6972011f01eab9f8d0a4584f32ee1e2a00f3231 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 13 Jun 2010 18:37:27 -0400 Subject: Embed libart_lgpl and libgnomecanvas. Both of these modules are deprecated and going away in GNOME 3 but we still rely heavily on them for GnomeCalendar and ETable. So, welcome to the island of unwanted libraries... --- libgnomecanvas/gnome-canvas-bpath.c | 175 ++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 libgnomecanvas/gnome-canvas-bpath.c (limited to 'libgnomecanvas/gnome-canvas-bpath.c') diff --git a/libgnomecanvas/gnome-canvas-bpath.c b/libgnomecanvas/gnome-canvas-bpath.c new file mode 100644 index 0000000000..f7f564a94d --- /dev/null +++ b/libgnomecanvas/gnome-canvas-bpath.c @@ -0,0 +1,175 @@ +/* Bpath 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. + * + * Copyright (C) 1998,1999 The Free Software Foundation + * + * Authors: Federico Mena + * Raph Levien + * Lauris Kaplinski + * Miguel de Icaza + * Cody Russell + * Rusty Conover + */ + +/* These includes are set up for standalone compile. If/when this codebase + is integrated into libgnomeui, the includes will need to change. */ + +#include +#include + +#include +#include "gnome-canvas.h" +#include "gnome-canvas-util.h" + +#include "gnome-canvas-bpath.h" +#include "gnome-canvas-shape.h" +#include "gnome-canvas-shape-private.h" +#include "gnome-canvas-path-def.h" + +enum { + PROP_0, + PROP_BPATH +}; + +static void gnome_canvas_bpath_class_init (GnomeCanvasBpathClass *class); +static void gnome_canvas_bpath_init (GnomeCanvasBpath *bpath); +static void gnome_canvas_bpath_destroy (GtkObject *object); +static void gnome_canvas_bpath_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec); +static void gnome_canvas_bpath_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec); + +static void gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); + + +static GnomeCanvasShapeClass *parent_class; + +GType +gnome_canvas_bpath_get_type (void) +{ + static GType bpath_type; + + if (!bpath_type) { + const GTypeInfo object_info = { + sizeof (GnomeCanvasBpathClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gnome_canvas_bpath_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (GnomeCanvasBpath), + 0, /* n_preallocs */ + (GInstanceInitFunc) gnome_canvas_bpath_init, + NULL /* value_table */ + }; + + bpath_type = g_type_register_static (GNOME_TYPE_CANVAS_SHAPE, "GnomeCanvasBpath", + &object_info, 0); + } + + return bpath_type; +} + +static void +gnome_canvas_bpath_class_init (GnomeCanvasBpathClass *class) +{ + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GnomeCanvasItemClass *item_class; + + gobject_class = (GObjectClass *) class; + object_class = (GtkObjectClass *) class; + item_class = (GnomeCanvasItemClass *) class; + + parent_class = g_type_class_peek_parent (class); + + /* when this gets checked into libgnomeui, change the + GTK_TYPE_POINTER to GTK_TYPE_GNOME_CANVAS_BPATH, and add an + entry to gnome-boxed.defs */ + + gobject_class->set_property = gnome_canvas_bpath_set_property; + gobject_class->get_property = gnome_canvas_bpath_get_property; + + object_class->destroy = gnome_canvas_bpath_destroy; + + g_object_class_install_property (gobject_class, + PROP_BPATH, + g_param_spec_boxed ("bpath", NULL, NULL, + GNOME_TYPE_CANVAS_PATH_DEF, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + item_class->update = gnome_canvas_bpath_update; +} + +static void +gnome_canvas_bpath_init (GnomeCanvasBpath *bpath) +{ + +} + +static void +gnome_canvas_bpath_destroy (GtkObject *object) +{ + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void +gnome_canvas_bpath_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeCanvasItem *item; + GnomeCanvasPathDef *gpp; + + item = GNOME_CANVAS_ITEM (object); + + switch (param_id) { + case PROP_BPATH: + gpp = (GnomeCanvasPathDef*) g_value_get_boxed (value); + + gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (object), gpp); + + gnome_canvas_item_request_update (item); + break; + + default: + break; + } +} + + +static void +gnome_canvas_bpath_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) +{ + GnomeCanvasShape *shape; + + shape = GNOME_CANVAS_SHAPE(object); + + switch (param_id) { + case PROP_BPATH: + g_value_set_boxed (value, shape->priv->path); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + break; + } +} + +static void +gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +{ + if(GNOME_CANVAS_ITEM_CLASS(parent_class)->update) { + (* GNOME_CANVAS_ITEM_CLASS(parent_class)->update)(item, affine, clip_path, flags); + } +} -- cgit