diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
commit | 0d4560cb0305029fa5f0739670286176ab47cb65 (patch) | |
tree | 9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/g_scalar.c | |
parent | eabeb928ddfdbe5fc6379efb87d9522803310649 (diff) | |
download | rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip |
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_scalar.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_scalar.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_scalar.c b/apps/plugins/pdbox/PDa/src/g_scalar.c index 329003e63e..8f9b5609d5 100644 --- a/apps/plugins/pdbox/PDa/src/g_scalar.c +++ b/apps/plugins/pdbox/PDa/src/g_scalar.c | |||
@@ -19,11 +19,18 @@ control their appearances by adding stuff to draw. | |||
19 | * added Krzysztof Czajas fix to avoid crashing... | 19 | * added Krzysztof Czajas fix to avoid crashing... |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifdef ROCKBOX | ||
23 | #include "plugin.h" | ||
24 | #include "pdbox.h" | ||
25 | #include "m_pd.h" | ||
26 | #include "g_canvas.h" | ||
27 | #else /* ROCKBOX */ | ||
22 | #include <stdlib.h> | 28 | #include <stdlib.h> |
23 | #include <string.h> | 29 | #include <string.h> |
24 | #include <stdio.h> /* for read/write to files */ | 30 | #include <stdio.h> /* for read/write to files */ |
25 | #include "m_pd.h" | 31 | #include "m_pd.h" |
26 | #include "g_canvas.h" | 32 | #include "g_canvas.h" |
33 | #endif /* ROCKBOX */ | ||
27 | 34 | ||
28 | t_class *scalar_class; | 35 | t_class *scalar_class; |
29 | 36 | ||
@@ -139,6 +146,9 @@ void glist_scalar(t_glist *glist, | |||
139 | t_binbuf *b; | 146 | t_binbuf *b; |
140 | int natoms, nextmsg = 0; | 147 | int natoms, nextmsg = 0; |
141 | t_atom *vec; | 148 | t_atom *vec; |
149 | #ifdef ROCKBOX | ||
150 | (void) classname; | ||
151 | #endif | ||
142 | if (!template_findbyname(templatesym)) | 152 | if (!template_findbyname(templatesym)) |
143 | { | 153 | { |
144 | pd_error(glist, "%s: no such template", | 154 | pd_error(glist, "%s: no such template", |
@@ -167,7 +177,9 @@ static void scalar_getrect(t_gobj *z, t_glist *owner, | |||
167 | int *xp1, int *yp1, int *xp2, int *yp2) | 177 | int *xp1, int *yp1, int *xp2, int *yp2) |
168 | { | 178 | { |
169 | t_scalar *x = (t_scalar *)z; | 179 | t_scalar *x = (t_scalar *)z; |
180 | #ifndef ROCKBOX | ||
170 | int hit = 0; | 181 | int hit = 0; |
182 | #endif | ||
171 | t_template *template = template_findbyname(x->sc_template); | 183 | t_template *template = template_findbyname(x->sc_template); |
172 | t_canvas *templatecanvas = template_findcanvas(template); | 184 | t_canvas *templatecanvas = template_findcanvas(template); |
173 | int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; | 185 | int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; |
@@ -213,7 +225,9 @@ static void scalar_getrect(t_gobj *z, t_glist *owner, | |||
213 | 225 | ||
214 | static void scalar_select(t_gobj *z, t_glist *owner, int state) | 226 | static void scalar_select(t_gobj *z, t_glist *owner, int state) |
215 | { | 227 | { |
228 | #ifndef ROCKBOX | ||
216 | t_scalar *x = (t_scalar *)z; | 229 | t_scalar *x = (t_scalar *)z; |
230 | #endif | ||
217 | /* post("scalar_select %d", state); */ | 231 | /* post("scalar_select %d", state); */ |
218 | /* later */ | 232 | /* later */ |
219 | if (state) | 233 | if (state) |
@@ -221,12 +235,16 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state) | |||
221 | int x1, y1, x2, y2; | 235 | int x1, y1, x2, y2; |
222 | scalar_getrect(z, owner, &x1, &y1, &x2, &y2); | 236 | scalar_getrect(z, owner, &x1, &y1, &x2, &y2); |
223 | x1--; x2++; y1--; y2++; | 237 | x1--; x2++; y1--; y2++; |
238 | #ifndef ROCKBOX | ||
224 | sys_vgui(".x%x.c create line %d %d %d %d %d %d %d %d %d %d \ | 239 | sys_vgui(".x%x.c create line %d %d %d %d %d %d %d %d %d %d \ |
225 | -width 0 -fill blue -tags select%x\n", | 240 | -width 0 -fill blue -tags select%x\n", |
226 | glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, | 241 | glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, |
227 | x); | 242 | x); |
243 | #endif | ||
228 | } | 244 | } |
245 | #ifndef ROCKBOX | ||
229 | else sys_vgui(".x%x.c delete select%x\n", glist_getcanvas(owner), x); | 246 | else sys_vgui(".x%x.c delete select%x\n", glist_getcanvas(owner), x); |
247 | #endif | ||
230 | } | 248 | } |
231 | 249 | ||
232 | static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) | 250 | static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) |
@@ -263,12 +281,21 @@ static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) | |||
263 | 281 | ||
264 | static void scalar_activate(t_gobj *z, t_glist *owner, int state) | 282 | static void scalar_activate(t_gobj *z, t_glist *owner, int state) |
265 | { | 283 | { |
284 | #ifdef ROCKBOX | ||
285 | (void) z; | ||
286 | (void) owner; | ||
287 | (void) state; | ||
288 | #endif | ||
266 | /* post("scalar_activate %d", state); */ | 289 | /* post("scalar_activate %d", state); */ |
267 | /* later */ | 290 | /* later */ |
268 | } | 291 | } |
269 | 292 | ||
270 | static void scalar_delete(t_gobj *z, t_glist *glist) | 293 | static void scalar_delete(t_gobj *z, t_glist *glist) |
271 | { | 294 | { |
295 | #ifdef ROCKBOX | ||
296 | (void) z; | ||
297 | (void) glist; | ||
298 | #endif | ||
272 | /* nothing to do */ | 299 | /* nothing to do */ |
273 | } | 300 | } |
274 | 301 | ||
@@ -285,12 +312,16 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) | |||
285 | { | 312 | { |
286 | if (vis) | 313 | if (vis) |
287 | { | 314 | { |
315 | #ifndef ROCKBOX | ||
288 | int x1 = glist_xtopixels(owner, basex); | 316 | int x1 = glist_xtopixels(owner, basex); |
289 | int y1 = glist_ytopixels(owner, basey); | 317 | int y1 = glist_ytopixels(owner, basey); |
290 | sys_vgui(".x%x.c create rectangle %d %d %d %d -tags scalar%x\n", | 318 | sys_vgui(".x%x.c create rectangle %d %d %d %d -tags scalar%x\n", |
291 | glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x); | 319 | glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x); |
320 | #endif | ||
292 | } | 321 | } |
322 | #ifndef ROCKBOX | ||
293 | else sys_vgui(".x%x.c delete scalar%x\n", glist_getcanvas(owner), x); | 323 | else sys_vgui(".x%x.c delete scalar%x\n", glist_getcanvas(owner), x); |
324 | #endif | ||
294 | return; | 325 | return; |
295 | } | 326 | } |
296 | 327 | ||
@@ -316,9 +347,9 @@ static int scalar_click(t_gobj *z, struct _glist *owner, | |||
316 | { | 347 | { |
317 | t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); | 348 | t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); |
318 | if (!wb) continue; | 349 | if (!wb) continue; |
319 | if (hit = (*wb->w_parentclickfn)(y, owner, | 350 | if((hit = (*wb->w_parentclickfn)(y, owner, |
320 | x, template, basex, basey, | 351 | x, template, basex, basey, |
321 | xpix, ypix, shift, alt, dbl, doit)) | 352 | xpix, ypix, shift, alt, dbl, doit))) |
322 | return (hit); | 353 | return (hit); |
323 | } | 354 | } |
324 | return (0); | 355 | return (0); |
@@ -331,8 +362,10 @@ static void scalar_save(t_gobj *z, t_binbuf *b) | |||
331 | { | 362 | { |
332 | t_scalar *x = (t_scalar *)z; | 363 | t_scalar *x = (t_scalar *)z; |
333 | t_binbuf *b2 = binbuf_new(); | 364 | t_binbuf *b2 = binbuf_new(); |
365 | #ifndef ROCKBOX | ||
334 | t_atom a, *argv; | 366 | t_atom a, *argv; |
335 | int i, argc; | 367 | int i, argc; |
368 | #endif | ||
336 | canvas_writescalar(x->sc_template, x->sc_vec, b2, 0); | 369 | canvas_writescalar(x->sc_template, x->sc_vec, b2, 0); |
337 | binbuf_addv(b, "ss", &s__X, gensym("scalar")); | 370 | binbuf_addv(b, "ss", &s__X, gensym("scalar")); |
338 | binbuf_addbinbuf(b, b2); | 371 | binbuf_addbinbuf(b, b2); |
@@ -342,6 +375,10 @@ static void scalar_save(t_gobj *z, t_binbuf *b) | |||
342 | 375 | ||
343 | static void scalar_properties(t_gobj *z, struct _glist *owner) | 376 | static void scalar_properties(t_gobj *z, struct _glist *owner) |
344 | { | 377 | { |
378 | #ifdef ROCKBOX | ||
379 | (void) z; | ||
380 | (void) owner; | ||
381 | #else /* ROCKBOX */ | ||
345 | t_scalar *x = (t_scalar *)z; | 382 | t_scalar *x = (t_scalar *)z; |
346 | char *buf, buf2[80]; | 383 | char *buf, buf2[80]; |
347 | int bufsize; | 384 | int bufsize; |
@@ -358,6 +395,7 @@ static void scalar_properties(t_gobj *z, struct _glist *owner) | |||
358 | sys_gui(buf); | 395 | sys_gui(buf); |
359 | sys_gui("}\n"); | 396 | sys_gui("}\n"); |
360 | t_freebytes(buf, bufsize+1); | 397 | t_freebytes(buf, bufsize+1); |
398 | #endif /* ROCKBOX */ | ||
361 | } | 399 | } |
362 | 400 | ||
363 | static t_widgetbehavior scalar_widgetbehavior = | 401 | static t_widgetbehavior scalar_widgetbehavior = |
@@ -373,8 +411,10 @@ static t_widgetbehavior scalar_widgetbehavior = | |||
373 | 411 | ||
374 | static void scalar_free(t_scalar *x) | 412 | static void scalar_free(t_scalar *x) |
375 | { | 413 | { |
414 | #ifndef ROCKBOX | ||
376 | int i; | 415 | int i; |
377 | t_dataslot *datatypes, *dt; | 416 | t_dataslot *datatypes, *dt; |
417 | #endif | ||
378 | t_symbol *templatesym = x->sc_template; | 418 | t_symbol *templatesym = x->sc_template; |
379 | t_template *template = template_findbyname(templatesym); | 419 | t_template *template = template_findbyname(templatesym); |
380 | if (!template) | 420 | if (!template) |
@@ -383,7 +423,9 @@ static void scalar_free(t_scalar *x) | |||
383 | return; | 423 | return; |
384 | } | 424 | } |
385 | word_free(x->sc_vec, template); | 425 | word_free(x->sc_vec, template); |
426 | #ifndef ROCKBOX | ||
386 | gfxstub_deleteforkey(x); | 427 | gfxstub_deleteforkey(x); |
428 | #endif | ||
387 | /* the "size" field in the class is zero, so Pd doesn't try to free | 429 | /* the "size" field in the class is zero, so Pd doesn't try to free |
388 | us automatically (see pd_free()) */ | 430 | us automatically (see pd_free()) */ |
389 | freebytes(x, sizeof(t_scalar) + (template->t_n - 1) * sizeof(*x->sc_vec)); | 431 | freebytes(x, sizeof(t_scalar) + (template->t_n - 1) * sizeof(*x->sc_vec)); |