1 /** \file
2 * SVG <animate> implementation.
3 *
4 * N.B. This file is currently just a stub file with no meaningful implementation.
5 */
6 /*
7 * Authors:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 * Abhishek Sharma
10 *
11 * Copyright (C) 2002 Lauris Kaplinski
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 #include "sp-animation.h"
18 #if 0
19 /* Feel free to remove this function and its calls. */
20 static void
21 log_set_attr(char const *const classname, unsigned int const key, char const *const value)
22 {
23 unsigned char const *const attr_name = sp_attribute_name(key);
24 if (value) {
25 g_print("%s: Set %s=%s\n", classname, attr_name, value);
26 } else {
27 g_print("%s: unset %s.\n", classname, attr_name);
28 }
29 }
30 #else
31 # define log_set_attr(_classname, _key, _value) static_cast<void>(0)
32 #endif
34 /* Animation base class */
36 static void sp_animation_class_init(SPAnimationClass *klass);
37 static void sp_animation_init(SPAnimation *animation);
39 static void sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
40 static void sp_animation_release(SPObject *object);
41 static void sp_animation_set(SPObject *object, unsigned int key, gchar const *value);
43 static SPObjectClass *animation_parent_class;
45 GType
46 sp_animation_get_type(void)
47 {
48 static GType animation_type = 0;
50 if (!animation_type) {
51 GTypeInfo animation_info = {
52 sizeof(SPAnimationClass),
53 NULL, NULL,
54 (GClassInitFunc) sp_animation_class_init,
55 NULL, NULL,
56 sizeof(SPAnimation),
57 16,
58 (GInstanceInitFunc) sp_animation_init,
59 NULL, /* value_table */
60 };
61 animation_type = g_type_register_static(SP_TYPE_OBJECT, "SPAnimation", &animation_info, (GTypeFlags)0);
62 }
63 return animation_type;
64 }
66 static void
67 sp_animation_class_init(SPAnimationClass *klass)
68 {
69 //GObjectClass *gobject_class = (GObjectClass *) klass;
70 SPObjectClass *sp_object_class = (SPObjectClass *) klass;
72 animation_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
74 sp_object_class->build = sp_animation_build;
75 sp_object_class->release = sp_animation_release;
76 sp_object_class->set = sp_animation_set;
77 }
79 static void
80 sp_animation_init(SPAnimation */*animation*/)
81 {
82 }
85 static void
86 sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
87 {
88 if (((SPObjectClass *) animation_parent_class)->build)
89 ((SPObjectClass *) animation_parent_class)->build(object, document, repr);
91 object->readAttr( "xlink:href" );
92 object->readAttr( "attributeName" );
93 object->readAttr( "attributeType" );
94 object->readAttr( "begin" );
95 object->readAttr( "dur" );
96 object->readAttr( "end" );
97 object->readAttr( "min" );
98 object->readAttr( "max" );
99 object->readAttr( "restart" );
100 object->readAttr( "repeatCount" );
101 object->readAttr( "repeatDur" );
102 object->readAttr( "fill" );
103 }
105 static void
106 sp_animation_release(SPObject */*object*/)
107 {
108 }
110 static void
111 sp_animation_set(SPObject *object, unsigned int key, gchar const *value)
112 {
113 //SPAnimation *animation = SP_ANIMATION(object);
115 log_set_attr("SPAnimation", key, value);
117 if (((SPObjectClass *) animation_parent_class)->set)
118 ((SPObjectClass *) animation_parent_class)->set(object, key, value);
119 }
121 /* Interpolated animation base class */
123 static void sp_ianimation_class_init(SPIAnimationClass *klass);
124 static void sp_ianimation_init(SPIAnimation *animation);
126 static void sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
127 static void sp_ianimation_release(SPObject *object);
128 static void sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value);
130 static SPObjectClass *ianimation_parent_class;
132 GType
133 sp_ianimation_get_type(void)
134 {
135 static GType type = 0;
137 if (!type) {
138 GTypeInfo info = {
139 sizeof(SPIAnimationClass),
140 NULL, NULL,
141 (GClassInitFunc) sp_ianimation_class_init,
142 NULL, NULL,
143 sizeof(SPIAnimation),
144 16,
145 (GInstanceInitFunc) sp_ianimation_init,
146 NULL, /* value_table */
147 };
148 type = g_type_register_static(SP_TYPE_OBJECT, "SPIAnimation", &info, (GTypeFlags)0);
149 }
150 return type;
151 }
153 static void
154 sp_ianimation_class_init(SPIAnimationClass *klass)
155 {
156 //GObjectClass *gobject_class = (GObjectClass *) klass;
157 SPObjectClass *sp_object_class = (SPObjectClass *) klass;
159 ianimation_parent_class = (SPObjectClass*)g_type_class_peek_parent(klass);
161 sp_object_class->build = sp_ianimation_build;
162 sp_object_class->release = sp_ianimation_release;
163 sp_object_class->set = sp_ianimation_set;
164 }
166 static void
167 sp_ianimation_init(SPIAnimation */*animation*/)
168 {
169 }
172 static void
173 sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
174 {
175 if (((SPObjectClass *) ianimation_parent_class)->build)
176 ((SPObjectClass *) ianimation_parent_class)->build(object, document, repr);
178 object->readAttr( "calcMode" );
179 object->readAttr( "values" );
180 object->readAttr( "keyTimes" );
181 object->readAttr( "keySplines" );
182 object->readAttr( "from" );
183 object->readAttr( "to" );
184 object->readAttr( "by" );
185 object->readAttr( "additive" );
186 object->readAttr( "accumulate" );
187 }
189 static void
190 sp_ianimation_release(SPObject */*object*/)
191 {
192 }
194 static void
195 sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value)
196 {
197 //SPIAnimation *ianimation = SP_IANIMATION(object);
199 log_set_attr("SPIAnimation", key, value);
201 if (((SPObjectClass *) ianimation_parent_class)->set)
202 ((SPObjectClass *) ianimation_parent_class)->set(object, key, value);
203 }
205 /* SVG <animate> */
207 static void sp_animate_class_init(SPAnimateClass *klass);
208 static void sp_animate_init(SPAnimate *animate);
210 static void sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
211 static void sp_animate_release(SPObject *object);
212 static void sp_animate_set(SPObject *object, unsigned int key, gchar const *value);
214 static SPIAnimationClass *animate_parent_class;
216 GType
217 sp_animate_get_type(void)
218 {
219 static GType type = 0;
221 if (!type) {
222 GTypeInfo info = {
223 sizeof(SPAnimateClass),
224 NULL, NULL,
225 (GClassInitFunc) sp_animate_class_init,
226 NULL, NULL,
227 sizeof(SPAnimate),
228 16,
229 (GInstanceInitFunc) sp_animate_init,
230 NULL, /* value_table */
231 };
232 type = g_type_register_static(SP_TYPE_IANIMATION, "SPAnimate", &info, (GTypeFlags)0);
233 }
234 return type;
235 }
237 static void
238 sp_animate_class_init(SPAnimateClass *klass)
239 {
240 //GObjectClass *gobject_class = (GObjectClass *) klass;
241 SPObjectClass *sp_object_class = (SPObjectClass *) klass;
243 animate_parent_class = (SPIAnimationClass*)g_type_class_peek_parent(klass);
245 sp_object_class->build = sp_animate_build;
246 sp_object_class->release = sp_animate_release;
247 sp_object_class->set = sp_animate_set;
248 }
250 static void
251 sp_animate_init(SPAnimate */*animate*/)
252 {
253 }
256 static void
257 sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
258 {
259 if (((SPObjectClass *) animate_parent_class)->build)
260 ((SPObjectClass *) animate_parent_class)->build(object, document, repr);
261 }
263 static void
264 sp_animate_release(SPObject */*object*/)
265 {
266 }
268 static void
269 sp_animate_set(SPObject *object, unsigned int key, gchar const *value)
270 {
271 //SPAnimate *animate = SP_ANIMATE(object);
273 log_set_attr("SPAnimate", key, value);
275 if (((SPObjectClass *) animate_parent_class)->set)
276 ((SPObjectClass *) animate_parent_class)->set(object, key, value);
277 }
280 /*
281 Local Variables:
282 mode:c++
283 c-file-style:"stroustrup"
284 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
285 indent-tabs-mode:nil
286 fill-column:99
287 End:
288 */
289 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :