~ubuntu-branches/ubuntu/maverick/gcompris/maverick

« back to all changes in this revision

Viewing changes to src/libgnomecanvas/gnome-canvas-bpath.c

  • Committer: Bazaar Package Importer
  • Author(s): Marc Gariepy, Marc Gariepy, Stephane Graber
  • Date: 2010-01-04 17:42:49 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20100104174249-7bupatd9dtxyhvs4
Tags: 9.0-0ubuntu1
[Marc Gariepy]
* New upstream release (9.0).
* Remove cache.c from POTFILES to avoid FTBFS
* Remove unneeded rm in debian/rules (file no longer exists upstream)

[Stephane Graber]
* Bump Debian standards to 3.8.3
* Add patch system (dpatch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Bpath item type for GnomeCanvas widget
2
 
 *
3
 
 * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget.  Tk is
4
 
 * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
5
 
 *
6
 
 * Copyright (C) 1998,1999 The Free Software Foundation
7
 
 *
8
 
 * Authors: Federico Mena <federico@nuclecu.unam.mx>
9
 
 *          Raph Levien <raph@acm.org>
10
 
 *          Lauris Kaplinski <lauris@ximian.com>
11
 
 *          Miguel de Icaza <miguel@kernel.org>
12
 
 *          Cody Russell <bratsche@gnome.org>
13
 
 *          Rusty Conover <rconover@bangtail.net>
14
 
 */
15
 
 
16
 
/* These includes are set up for standalone compile. If/when this codebase
17
 
   is integrated into libgnomeui, the includes will need to change. */
18
 
 
19
 
#include <math.h>
20
 
#include <string.h>
21
 
 
22
 
#include <gtk/gtkobject.h>
23
 
#include "gnome-canvas.h"
24
 
#include "gnome-canvas-util.h"
25
 
 
26
 
#include "gnome-canvas-bpath.h"
27
 
#include "gnome-canvas-shape.h"
28
 
#include "gnome-canvas-shape-private.h"
29
 
#include "gnome-canvas-path-def.h"
30
 
 
31
 
enum {
32
 
        PROP_0,
33
 
        PROP_BPATH
34
 
};
35
 
 
36
 
static void gnome_canvas_bpath_class_init   (GnomeCanvasBpathClass *class);
37
 
static void gnome_canvas_bpath_init         (GnomeCanvasBpath      *bpath);
38
 
static void gnome_canvas_bpath_destroy      (GtkObject               *object);
39
 
static void gnome_canvas_bpath_set_property (GObject               *object,
40
 
                                             guint                  param_id,
41
 
                                             const GValue          *value,
42
 
                                             GParamSpec            *pspec);
43
 
static void gnome_canvas_bpath_get_property (GObject               *object,
44
 
                                             guint                  param_id,
45
 
                                             GValue                *value,
46
 
                                             GParamSpec            *pspec);
47
 
 
48
 
static void   gnome_canvas_bpath_update      (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags);
49
 
 
50
 
 
51
 
static GnomeCanvasShapeClass *parent_class;
52
 
 
53
 
GtkType
54
 
gnome_canvas_bpath_get_type (void)
55
 
{
56
 
        static GType bpath_type;
57
 
 
58
 
        if (!bpath_type) {
59
 
                static const GTypeInfo object_info = {
60
 
                        sizeof (GnomeCanvasBpathClass),
61
 
                        (GBaseInitFunc) NULL,
62
 
                        (GBaseFinalizeFunc) NULL,
63
 
                        (GClassInitFunc) gnome_canvas_bpath_class_init,
64
 
                        (GClassFinalizeFunc) NULL,
65
 
                        NULL,                   /* class_data */
66
 
                        sizeof (GnomeCanvasBpath),
67
 
                        0,                      /* n_preallocs */
68
 
                        (GInstanceInitFunc) gnome_canvas_bpath_init,
69
 
                        NULL                    /* value_table */
70
 
                };
71
 
 
72
 
                bpath_type = g_type_register_static (GNOME_TYPE_CANVAS_SHAPE, "GnomeCanvasBpath",
73
 
                                                     &object_info, 0);
74
 
        }
75
 
 
76
 
        return bpath_type;
77
 
}
78
 
 
79
 
static void
80
 
gnome_canvas_bpath_class_init (GnomeCanvasBpathClass *class)
81
 
{
82
 
        GObjectClass         *gobject_class;
83
 
        GtkObjectClass       *object_class;
84
 
        GnomeCanvasItemClass *item_class;
85
 
 
86
 
        gobject_class = (GObjectClass *) class;
87
 
        object_class = (GtkObjectClass *) class;
88
 
        item_class = (GnomeCanvasItemClass *) class;
89
 
 
90
 
        parent_class = g_type_class_peek_parent (class);
91
 
 
92
 
        /* when this gets checked into libgnomeui, change the
93
 
           GTK_TYPE_POINTER to GTK_TYPE_GNOME_CANVAS_BPATH, and add an
94
 
           entry to gnome-boxed.defs */
95
 
 
96
 
        gobject_class->set_property = gnome_canvas_bpath_set_property;
97
 
        gobject_class->get_property = gnome_canvas_bpath_get_property;
98
 
 
99
 
        object_class->destroy = gnome_canvas_bpath_destroy;
100
 
 
101
 
        g_object_class_install_property (gobject_class,
102
 
                                         PROP_BPATH,
103
 
                                         g_param_spec_boxed ("bpath", NULL, NULL,
104
 
                                                             GNOME_TYPE_CANVAS_PATH_DEF,
105
 
                                                             (G_PARAM_READABLE | G_PARAM_WRITABLE)));
106
 
 
107
 
        item_class->update = gnome_canvas_bpath_update;
108
 
}
109
 
 
110
 
static void
111
 
gnome_canvas_bpath_init (GnomeCanvasBpath *bpath)
112
 
{
113
 
 
114
 
}
115
 
 
116
 
static void
117
 
gnome_canvas_bpath_destroy (GtkObject *object)
118
 
{
119
 
        if (GTK_OBJECT_CLASS (parent_class)->destroy)
120
 
                (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
121
 
}
122
 
 
123
 
static void
124
 
gnome_canvas_bpath_set_property (GObject      *object,
125
 
                                 guint         param_id,
126
 
                                 const GValue *value,
127
 
                                 GParamSpec   *pspec)
128
 
{
129
 
        GnomeCanvasItem         *item;
130
 
        GnomeCanvasPathDef      *gpp;
131
 
 
132
 
        item = GNOME_CANVAS_ITEM (object);
133
 
 
134
 
        switch (param_id) {
135
 
        case PROP_BPATH:
136
 
                gpp = (GnomeCanvasPathDef*) g_value_get_boxed (value);
137
 
 
138
 
                gnome_canvas_shape_set_path_def (GNOME_CANVAS_SHAPE (object), gpp);
139
 
 
140
 
                gnome_canvas_item_request_update (item);
141
 
                break;
142
 
 
143
 
        default:
144
 
                break;
145
 
        }
146
 
}
147
 
 
148
 
 
149
 
static void
150
 
gnome_canvas_bpath_get_property (GObject     *object,
151
 
                                 guint        param_id,
152
 
                                 GValue      *value,
153
 
                                 GParamSpec  *pspec)
154
 
{
155
 
        GnomeCanvasShape        *shape;
156
 
 
157
 
        shape = GNOME_CANVAS_SHAPE(object);
158
 
 
159
 
        switch (param_id) {
160
 
        case PROP_BPATH:
161
 
                g_value_set_boxed (value, shape->priv->path);
162
 
                break;
163
 
        default:
164
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
165
 
                break;
166
 
        }
167
 
}
168
 
 
169
 
static void
170
 
gnome_canvas_bpath_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
171
 
{
172
 
        if(GNOME_CANVAS_ITEM_CLASS(parent_class)->update) {
173
 
                (* GNOME_CANVAS_ITEM_CLASS(parent_class)->update)(item, affine, clip_path, flags);
174
 
        }
175
 
}