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_bang.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_bang.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_bang.c | 116 |
1 files changed, 115 insertions, 1 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_bang.c b/apps/plugins/pdbox/PDa/src/g_bang.c index 6556f7019a..ce1bed9c9a 100644 --- a/apps/plugins/pdbox/PDa/src/g_bang.c +++ b/apps/plugins/pdbox/PDa/src/g_bang.c | |||
@@ -5,7 +5,13 @@ | |||
5 | /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ | 5 | /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ |
6 | /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ | 6 | /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ |
7 | 7 | ||
8 | 8 | #ifdef ROCKBOX | |
9 | #include "plugin.h" | ||
10 | #include "pdbox.h" | ||
11 | #include "m_pd.h" | ||
12 | #include "g_canvas.h" | ||
13 | #include "g_all_guis.h" | ||
14 | #else /* ROCKBOX */ | ||
9 | #include <stdlib.h> | 15 | #include <stdlib.h> |
10 | #include <string.h> | 16 | #include <string.h> |
11 | #include <stdio.h> | 17 | #include <stdio.h> |
@@ -21,6 +27,7 @@ | |||
21 | #else | 27 | #else |
22 | #include <unistd.h> | 28 | #include <unistd.h> |
23 | #endif | 29 | #endif |
30 | #endif /* ROCKBOX */ | ||
24 | 31 | ||
25 | 32 | ||
26 | /* --------------- bng gui-bang ------------------------- */ | 33 | /* --------------- bng gui-bang ------------------------- */ |
@@ -33,15 +40,24 @@ static t_class *bng_class; | |||
33 | 40 | ||
34 | void bng_draw_update(t_bng *x, t_glist *glist) | 41 | void bng_draw_update(t_bng *x, t_glist *glist) |
35 | { | 42 | { |
43 | #ifdef ROCKBOX | ||
44 | (void) x; | ||
45 | (void) glist; | ||
46 | #else /* ROCKBOX */ | ||
36 | if(glist_isvisible(glist)) | 47 | if(glist_isvisible(glist)) |
37 | { | 48 | { |
38 | sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", glist_getcanvas(glist), x, | 49 | sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", glist_getcanvas(glist), x, |
39 | x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); | 50 | x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); |
40 | } | 51 | } |
52 | #endif /* ROCKBOX */ | ||
41 | } | 53 | } |
42 | 54 | ||
43 | void bng_draw_new(t_bng *x, t_glist *glist) | 55 | void bng_draw_new(t_bng *x, t_glist *glist) |
44 | { | 56 | { |
57 | #ifdef ROCKBOX | ||
58 | (void) x; | ||
59 | (void) glist; | ||
60 | #else /* ROCKBOX */ | ||
45 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 61 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
46 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 62 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
47 | t_canvas *canvas=glist_getcanvas(glist); | 63 | t_canvas *canvas=glist_getcanvas(glist); |
@@ -69,10 +85,15 @@ void bng_draw_new(t_bng *x, t_glist *glist) | |||
69 | sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", | 85 | sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", |
70 | canvas, xpos, ypos, | 86 | canvas, xpos, ypos, |
71 | xpos + IOWIDTH, ypos+1, x, 0); | 87 | xpos + IOWIDTH, ypos+1, x, 0); |
88 | #endif /* ROCKBOX */ | ||
72 | } | 89 | } |
73 | 90 | ||
74 | void bng_draw_move(t_bng *x, t_glist *glist) | 91 | void bng_draw_move(t_bng *x, t_glist *glist) |
75 | { | 92 | { |
93 | #ifdef ROCKBOX | ||
94 | (void) x; | ||
95 | (void) glist; | ||
96 | #else /* ROCKBOX */ | ||
76 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 97 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
77 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 98 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
78 | t_canvas *canvas=glist_getcanvas(glist); | 99 | t_canvas *canvas=glist_getcanvas(glist); |
@@ -96,10 +117,15 @@ void bng_draw_move(t_bng *x, t_glist *glist) | |||
96 | sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", | 117 | sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", |
97 | canvas, x, 0, xpos, ypos, | 118 | canvas, x, 0, xpos, ypos, |
98 | xpos + IOWIDTH, ypos+1); | 119 | xpos + IOWIDTH, ypos+1); |
120 | #endif /* ROCKBOX */ | ||
99 | } | 121 | } |
100 | 122 | ||
101 | void bng_draw_erase(t_bng* x, t_glist* glist) | 123 | void bng_draw_erase(t_bng* x, t_glist* glist) |
102 | { | 124 | { |
125 | #ifdef ROCKBOX | ||
126 | (void) x; | ||
127 | (void) glist; | ||
128 | #else /* ROCKBOX */ | ||
103 | t_canvas *canvas=glist_getcanvas(glist); | 129 | t_canvas *canvas=glist_getcanvas(glist); |
104 | 130 | ||
105 | sys_vgui(".x%x.c delete %xBASE\n", canvas, x); | 131 | sys_vgui(".x%x.c delete %xBASE\n", canvas, x); |
@@ -109,10 +135,15 @@ void bng_draw_erase(t_bng* x, t_glist* glist) | |||
109 | sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); | 135 | sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); |
110 | if(!x->x_gui.x_fsf.x_rcv_able) | 136 | if(!x->x_gui.x_fsf.x_rcv_able) |
111 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 137 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
138 | #endif /* ROCKBOX */ | ||
112 | } | 139 | } |
113 | 140 | ||
114 | void bng_draw_config(t_bng* x, t_glist* glist) | 141 | void bng_draw_config(t_bng* x, t_glist* glist) |
115 | { | 142 | { |
143 | #ifdef ROCKBOX | ||
144 | (void) x; | ||
145 | (void) glist; | ||
146 | #else /* ROCKBOX */ | ||
116 | t_canvas *canvas=glist_getcanvas(glist); | 147 | t_canvas *canvas=glist_getcanvas(glist); |
117 | 148 | ||
118 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", | 149 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", |
@@ -122,10 +153,16 @@ void bng_draw_config(t_bng* x, t_glist* glist) | |||
122 | sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); | 153 | sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); |
123 | sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", canvas, x, | 154 | sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", canvas, x, |
124 | x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); | 155 | x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); |
156 | #endif /* ROCKBOX */ | ||
125 | } | 157 | } |
126 | 158 | ||
127 | void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) | 159 | void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) |
128 | { | 160 | { |
161 | #ifdef ROCKBOX | ||
162 | (void) x; | ||
163 | (void) glist; | ||
164 | (void) old_snd_rcv_flags; | ||
165 | #else /* ROCKBOX */ | ||
129 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 166 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
130 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 167 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
131 | t_canvas *canvas=glist_getcanvas(glist); | 168 | t_canvas *canvas=glist_getcanvas(glist); |
@@ -143,10 +180,15 @@ void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) | |||
143 | xpos + IOWIDTH, ypos+1, x, 0); | 180 | xpos + IOWIDTH, ypos+1, x, 0); |
144 | if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) | 181 | if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) |
145 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 182 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
183 | #endif /* ROCKBOX */ | ||
146 | } | 184 | } |
147 | 185 | ||
148 | void bng_draw_select(t_bng* x, t_glist* glist) | 186 | void bng_draw_select(t_bng* x, t_glist* glist) |
149 | { | 187 | { |
188 | #ifdef ROCKBOX | ||
189 | (void) x; | ||
190 | (void) glist; | ||
191 | #else /* ROCKBOX */ | ||
150 | t_canvas *canvas=glist_getcanvas(glist); | 192 | t_canvas *canvas=glist_getcanvas(glist); |
151 | 193 | ||
152 | if(x->x_gui.x_fsf.x_selected) | 194 | if(x->x_gui.x_fsf.x_selected) |
@@ -161,6 +203,7 @@ void bng_draw_select(t_bng* x, t_glist* glist) | |||
161 | sys_vgui(".x%x.c itemconfigure %xBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); | 203 | sys_vgui(".x%x.c itemconfigure %xBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); |
162 | sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); | 204 | sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); |
163 | } | 205 | } |
206 | #endif /* ROCKBOX */ | ||
164 | } | 207 | } |
165 | 208 | ||
166 | void bng_draw(t_bng *x, t_glist *glist, int mode) | 209 | void bng_draw(t_bng *x, t_glist *glist, int mode) |
@@ -232,6 +275,10 @@ void bng_check_minmax(t_bng *x, int ftbreak, int fthold) | |||
232 | 275 | ||
233 | static void bng_properties(t_gobj *z, t_glist *owner) | 276 | static void bng_properties(t_gobj *z, t_glist *owner) |
234 | { | 277 | { |
278 | #ifdef ROCKBOX | ||
279 | (void) z; | ||
280 | (void) owner; | ||
281 | #else /* ROCKBOX */ | ||
235 | t_bng *x = (t_bng *)z; | 282 | t_bng *x = (t_bng *)z; |
236 | char buf[800]; | 283 | char buf[800]; |
237 | t_symbol *srl[3]; | 284 | t_symbol *srl[3]; |
@@ -253,6 +300,7 @@ static void bng_properties(t_gobj *z, t_glist *owner) | |||
253 | x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, | 300 | x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, |
254 | 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); | 301 | 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); |
255 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); | 302 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); |
303 | #endif /* ROCKBOX */ | ||
256 | } | 304 | } |
257 | 305 | ||
258 | static void bng_set(t_bng *x) | 306 | static void bng_set(t_bng *x) |
@@ -316,6 +364,9 @@ static void bng_bang2(t_bng *x)/*wird immer gesendet, wenn moeglich*/ | |||
316 | 364 | ||
317 | static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) | 365 | static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) |
318 | { | 366 | { |
367 | #ifdef ROCKBOX | ||
368 | (void) s; | ||
369 | #endif | ||
319 | t_symbol *srl[3]; | 370 | t_symbol *srl[3]; |
320 | int a = (int)atom_getintarg(0, argc, argv); | 371 | int a = (int)atom_getintarg(0, argc, argv); |
321 | int fthold = (int)atom_getintarg(2, argc, argv); | 372 | int fthold = (int)atom_getintarg(2, argc, argv); |
@@ -333,33 +384,84 @@ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) | |||
333 | 384 | ||
334 | static void bng_click(t_bng *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) | 385 | static void bng_click(t_bng *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) |
335 | { | 386 | { |
387 | #ifdef ROCKBOX | ||
388 | (void) xpos; | ||
389 | (void) ypos; | ||
390 | (void) shift; | ||
391 | (void) ctrl; | ||
392 | (void) alt; | ||
393 | #endif | ||
336 | bng_set(x); | 394 | bng_set(x); |
337 | bng_bout2(x); | 395 | bng_bout2(x); |
338 | } | 396 | } |
339 | 397 | ||
340 | static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) | 398 | static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) |
341 | { | 399 | { |
400 | #ifdef ROCKBOX | ||
401 | (void) glist; | ||
402 | (void) dbl; | ||
403 | #endif | ||
342 | if(doit) | 404 | if(doit) |
343 | bng_click((t_bng *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); | 405 | bng_click((t_bng *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); |
344 | return (1); | 406 | return (1); |
345 | } | 407 | } |
346 | 408 | ||
347 | static void bng_float(t_bng *x, t_floatarg f) | 409 | static void bng_float(t_bng *x, t_floatarg f) |
410 | #ifdef ROCKBOX | ||
411 | { | ||
412 | (void) f; | ||
413 | |||
414 | bng_bang2(x); | ||
415 | } | ||
416 | #else /* ROCKBOX */ | ||
348 | {bng_bang2(x);} | 417 | {bng_bang2(x);} |
418 | #endif /* ROCKBOX */ | ||
349 | 419 | ||
350 | static void bng_symbol(t_bng *x, t_symbol *s) | 420 | static void bng_symbol(t_bng *x, t_symbol *s) |
421 | #ifdef ROCKBOX | ||
422 | { | ||
423 | (void) s; | ||
424 | |||
425 | bng_bang2(x); | ||
426 | } | ||
427 | #else /* ROCKBOX */ | ||
351 | {bng_bang2(x);} | 428 | {bng_bang2(x);} |
429 | #endif /* ROCKBOX */ | ||
352 | 430 | ||
353 | static void bng_pointer(t_bng *x, t_gpointer *gp) | 431 | static void bng_pointer(t_bng *x, t_gpointer *gp) |
432 | #ifdef ROCKBOX | ||
433 | { | ||
434 | (void) gp; | ||
435 | |||
436 | bng_bang2(x); | ||
437 | } | ||
438 | #else /* ROCKBOX */ | ||
354 | {bng_bang2(x);} | 439 | {bng_bang2(x);} |
440 | #endif /* ROCKBOX */ | ||
355 | 441 | ||
356 | static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av) | 442 | static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av) |
357 | { | 443 | { |
444 | #ifdef ROCKBOX | ||
445 | (void) s; | ||
446 | (void) ac; | ||
447 | (void) av; | ||
448 | #endif /* ROCKBOX */ | ||
449 | |||
358 | bng_bang2(x); | 450 | bng_bang2(x); |
359 | } | 451 | } |
360 | 452 | ||
361 | static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv) | 453 | static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv) |
454 | #ifdef ROCKBOX | ||
455 | { | ||
456 | (void) s; | ||
457 | (void) argc; | ||
458 | (void) argv; | ||
459 | |||
460 | bng_bang2(x); | ||
461 | } | ||
462 | #else /* ROCKBOX */ | ||
362 | {bng_bang2(x);} | 463 | {bng_bang2(x);} |
464 | #endif /* ROCKBOX */ | ||
363 | 465 | ||
364 | static void bng_loadbang(t_bng *x) | 466 | static void bng_loadbang(t_bng *x) |
365 | { | 467 | { |
@@ -372,6 +474,9 @@ static void bng_loadbang(t_bng *x) | |||
372 | 474 | ||
373 | static void bng_size(t_bng *x, t_symbol *s, int ac, t_atom *av) | 475 | static void bng_size(t_bng *x, t_symbol *s, int ac, t_atom *av) |
374 | { | 476 | { |
477 | #ifdef ROCKBOX | ||
478 | (void) s; | ||
479 | #endif | ||
375 | x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); | 480 | x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); |
376 | x->x_gui.x_h = x->x_gui.x_w; | 481 | x->x_gui.x_h = x->x_gui.x_w; |
377 | iemgui_size((void *)x, &x->x_gui); | 482 | iemgui_size((void *)x, &x->x_gui); |
@@ -385,6 +490,9 @@ static void bng_pos(t_bng *x, t_symbol *s, int ac, t_atom *av) | |||
385 | 490 | ||
386 | static void bng_flashtime(t_bng *x, t_symbol *s, int ac, t_atom *av) | 491 | static void bng_flashtime(t_bng *x, t_symbol *s, int ac, t_atom *av) |
387 | { | 492 | { |
493 | #ifdef ROCKBOX | ||
494 | (void) s; | ||
495 | #endif | ||
388 | bng_check_minmax(x, (int)atom_getintarg(0, ac, av), | 496 | bng_check_minmax(x, (int)atom_getintarg(0, ac, av), |
389 | (int)atom_getintarg(1, ac, av)); | 497 | (int)atom_getintarg(1, ac, av)); |
390 | } | 498 | } |
@@ -437,7 +545,11 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv) | |||
437 | int fs=8; | 545 | int fs=8; |
438 | int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, | 546 | int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, |
439 | fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; | 547 | fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; |
548 | #ifdef ROCKBOX | ||
549 | (void) s; | ||
550 | #else | ||
440 | char str[144]; | 551 | char str[144]; |
552 | #endif | ||
441 | 553 | ||
442 | iem_inttosymargs(&x->x_gui.x_isa, 0); | 554 | iem_inttosymargs(&x->x_gui.x_isa, 0); |
443 | iem_inttofstyle(&x->x_gui.x_fsf, 0); | 555 | iem_inttofstyle(&x->x_gui.x_fsf, 0); |
@@ -511,7 +623,9 @@ static void bng_ff(t_bng *x) | |||
511 | clock_free(x->x_clock_lck); | 623 | clock_free(x->x_clock_lck); |
512 | clock_free(x->x_clock_brk); | 624 | clock_free(x->x_clock_brk); |
513 | clock_free(x->x_clock_hld); | 625 | clock_free(x->x_clock_hld); |
626 | #ifndef ROCKBOX | ||
514 | gfxstub_deleteforkey(x); | 627 | gfxstub_deleteforkey(x); |
628 | #endif | ||
515 | } | 629 | } |
516 | 630 | ||
517 | void g_bang_setup(void) | 631 | void g_bang_setup(void) |