Code

switch to sigc++ signal for "release"
[inkscape.git] / src / sp-animation.cpp
1 #define __SP_ANIMATION_C__
3 /** \file
4  * SVG <animate> implementation.
5  *
6  * N.B. This file is currently just a stub file with no meaningful implementation.
7  */
8 /*
9  * Authors:
10  *   Lauris Kaplinski <lauris@kaplinski.com>
11  *
12  * Copyright (C) 2002 Lauris Kaplinski
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #include "sp-animation.h"
19 #if 0
20 /* Feel free to remove this function and its calls. */
21 static void
22 log_set_attr(char const *const classname, unsigned int const key, char const *const value)
23 {
24     unsigned char const *const attr_name = sp_attribute_name(key);
25     if (value) {
26         g_print("%s: Set %s=%s\n", classname, attr_name, value);
27     } else {
28         g_print("%s: unset %s.\n", classname, attr_name);
29     }
30 }
31 #else
32 # define log_set_attr(_classname, _key, _value) static_cast<void>(0)
33 #endif
35 /* Animation base class */
37 static void sp_animation_class_init(SPAnimationClass *klass);
38 static void sp_animation_init(SPAnimation *animation);
40 static void sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
41 static void sp_animation_release(SPObject *object);
42 static void sp_animation_set(SPObject *object, unsigned int key, gchar const *value);
44 static SPObjectClass *animation_parent_class;
46 GType
47 sp_animation_get_type(void)
48 {
49     static GType animation_type = 0;
51     if (!animation_type) {
52         GTypeInfo animation_info = {
53             sizeof(SPAnimationClass),
54             NULL, NULL,
55             (GClassInitFunc) sp_animation_class_init,
56             NULL, NULL,
57             sizeof(SPAnimation),
58             16,
59             (GInstanceInitFunc) sp_animation_init,
60             NULL,   /* value_table */
61         };
62         animation_type = g_type_register_static(SP_TYPE_OBJECT, "SPAnimation", &animation_info, (GTypeFlags)0);
63     }
64     return animation_type;
65 }
67 static void
68 sp_animation_class_init(SPAnimationClass *klass)
69 {
70     //GObjectClass *gobject_class = (GObjectClass *) klass;
71     SPObjectClass *sp_object_class = (SPObjectClass *) klass;
73     animation_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
75     sp_object_class->build = sp_animation_build;
76     sp_object_class->release = sp_animation_release;
77     sp_object_class->set = sp_animation_set;
78 }
80 static void
81 sp_animation_init(SPAnimation *animation)
82 {
83 }
86 static void
87 sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
88 {
89     if (((SPObjectClass *) animation_parent_class)->build)
90         ((SPObjectClass *) animation_parent_class)->build(object, document, repr);
92     sp_object_read_attr(object, "xlink:href");
93     sp_object_read_attr(object, "attributeName");
94     sp_object_read_attr(object, "attributeType");
95     sp_object_read_attr(object, "begin");
96     sp_object_read_attr(object, "dur");
97     sp_object_read_attr(object, "end");
98     sp_object_read_attr(object, "min");
99     sp_object_read_attr(object, "max");
100     sp_object_read_attr(object, "restart");
101     sp_object_read_attr(object, "repeatCount");
102     sp_object_read_attr(object, "repeatDur");
103     sp_object_read_attr(object, "fill");
106 static void
107 sp_animation_release(SPObject *object)
111 static void
112 sp_animation_set(SPObject *object, unsigned int key, gchar const *value)
114     //SPAnimation *animation = SP_ANIMATION(object);
116     log_set_attr("SPAnimation", key, value);
118     if (((SPObjectClass *) animation_parent_class)->set)
119         ((SPObjectClass *) animation_parent_class)->set(object, key, value);
122 /* Interpolated animation base class */
124 static void sp_ianimation_class_init(SPIAnimationClass *klass);
125 static void sp_ianimation_init(SPIAnimation *animation);
127 static void sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
128 static void sp_ianimation_release(SPObject *object);
129 static void sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value);
131 static SPObjectClass *ianimation_parent_class;
133 GType
134 sp_ianimation_get_type(void)
136     static GType type = 0;
138     if (!type) {
139         GTypeInfo info = {
140             sizeof(SPIAnimationClass),
141             NULL, NULL,
142             (GClassInitFunc) sp_ianimation_class_init,
143             NULL, NULL,
144             sizeof(SPIAnimation),
145             16,
146             (GInstanceInitFunc) sp_ianimation_init,
147             NULL,   /* value_table */
148         };
149         type = g_type_register_static(SP_TYPE_OBJECT, "SPIAnimation", &info, (GTypeFlags)0);
150     }
151     return type;
154 static void
155 sp_ianimation_class_init(SPIAnimationClass *klass)
157     //GObjectClass *gobject_class = (GObjectClass *) klass;
158     SPObjectClass *sp_object_class = (SPObjectClass *) klass;
160     ianimation_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
162     sp_object_class->build = sp_ianimation_build;
163     sp_object_class->release = sp_ianimation_release;
164     sp_object_class->set = sp_ianimation_set;
167 static void
168 sp_ianimation_init(SPIAnimation *animation)
173 static void
174 sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
176     if (((SPObjectClass *) ianimation_parent_class)->build)
177         ((SPObjectClass *) ianimation_parent_class)->build(object, document, repr);
179     sp_object_read_attr(object, "calcMode");
180     sp_object_read_attr(object, "values");
181     sp_object_read_attr(object, "keyTimes");
182     sp_object_read_attr(object, "keySplines");
183     sp_object_read_attr(object, "from");
184     sp_object_read_attr(object, "to");
185     sp_object_read_attr(object, "by");
186     sp_object_read_attr(object, "additive");
187     sp_object_read_attr(object, "accumulate");
190 static void
191 sp_ianimation_release(SPObject *object)
195 static void
196 sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value)
198     //SPIAnimation *ianimation = SP_IANIMATION(object);
200     log_set_attr("SPIAnimation", key, value);
202     if (((SPObjectClass *) ianimation_parent_class)->set)
203         ((SPObjectClass *) ianimation_parent_class)->set(object, key, value);
206 /* SVG <animate> */
208 static void sp_animate_class_init(SPAnimateClass *klass);
209 static void sp_animate_init(SPAnimate *animate);
211 static void sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
212 static void sp_animate_release(SPObject *object);
213 static void sp_animate_set(SPObject *object, unsigned int key, gchar const *value);
215 static SPIAnimationClass *animate_parent_class;
217 GType
218 sp_animate_get_type(void)
220     static GType type = 0;
222     if (!type) {
223         GTypeInfo info = {
224             sizeof(SPAnimateClass),
225             NULL, NULL,
226             (GClassInitFunc) sp_animate_class_init,
227             NULL, NULL,
228             sizeof(SPAnimate),
229             16,
230             (GInstanceInitFunc) sp_animate_init,
231             NULL,   /* value_table */
232         };
233         type = g_type_register_static(SP_TYPE_IANIMATION, "SPAnimate", &info, (GTypeFlags)0);
234     }
235     return type;
238 static void
239 sp_animate_class_init(SPAnimateClass *klass)
241     //GObjectClass *gobject_class = (GObjectClass *) klass;
242     SPObjectClass *sp_object_class = (SPObjectClass *) klass;
244     animate_parent_class = (SPIAnimationClass*)g_type_class_peek_parent(klass);
246     sp_object_class->build = sp_animate_build;
247     sp_object_class->release = sp_animate_release;
248     sp_object_class->set = sp_animate_set;
251 static void
252 sp_animate_init(SPAnimate *animate)
257 static void
258 sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
260     if (((SPObjectClass *) animate_parent_class)->build)
261         ((SPObjectClass *) animate_parent_class)->build(object, document, repr);
264 static void
265 sp_animate_release(SPObject *object)
269 static void
270 sp_animate_set(SPObject *object, unsigned int key, gchar const *value)
272     //SPAnimate *animate = SP_ANIMATE(object);
274     log_set_attr("SPAnimate", key, value);
276     if (((SPObjectClass *) animate_parent_class)->set)
277         ((SPObjectClass *) animate_parent_class)->set(object, key, value);
281 /*
282   Local Variables:
283   mode:c++
284   c-file-style:"stroustrup"
285   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
286   indent-tabs-mode:nil
287   fill-column:99
288   End:
289 */
290 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :