diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_numbox.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_numbox.c | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_numbox.c b/apps/plugins/pdbox/PDa/src/g_numbox.c index 1c4dbb5e48..a5e0a447dc 100644 --- a/apps/plugins/pdbox/PDa/src/g_numbox.c +++ b/apps/plugins/pdbox/PDa/src/g_numbox.c | |||
@@ -4,6 +4,13 @@ | |||
4 | 4 | ||
5 | /* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ | 5 | /* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ |
6 | 6 | ||
7 | #ifdef ROCKBOX | ||
8 | #include "plugin.h" | ||
9 | #include "pdbox.h" | ||
10 | #include "m_pd.h" | ||
11 | #include "g_canvas.h" | ||
12 | #include "g_all_guis.h" | ||
13 | #else /* ROCKBOX */ | ||
7 | #include <stdlib.h> | 14 | #include <stdlib.h> |
8 | #include <string.h> | 15 | #include <string.h> |
9 | #include <stdio.h> | 16 | #include <stdio.h> |
@@ -19,6 +26,7 @@ | |||
19 | #else | 26 | #else |
20 | #include <unistd.h> | 27 | #include <unistd.h> |
21 | #endif | 28 | #endif |
29 | #endif /* ROCKBOX */ | ||
22 | 30 | ||
23 | /*------------------ global varaibles -------------------------*/ | 31 | /*------------------ global varaibles -------------------------*/ |
24 | 32 | ||
@@ -76,7 +84,11 @@ void my_numbox_ftoa(t_my_numbox *x) | |||
76 | double f=x->x_val; | 84 | double f=x->x_val; |
77 | int bufsize, is_exp=0, i, idecimal; | 85 | int bufsize, is_exp=0, i, idecimal; |
78 | 86 | ||
87 | #ifdef ROCKBOX | ||
88 | ftoan(f, x->x_buf, 10); | ||
89 | #else | ||
79 | sprintf(x->x_buf, "%g", f); | 90 | sprintf(x->x_buf, "%g", f); |
91 | #endif | ||
80 | bufsize = strlen(x->x_buf); | 92 | bufsize = strlen(x->x_buf); |
81 | if(bufsize >= 5)/* if it is in exponential mode */ | 93 | if(bufsize >= 5)/* if it is in exponential mode */ |
82 | { | 94 | { |
@@ -130,6 +142,10 @@ void my_numbox_ftoa(t_my_numbox *x) | |||
130 | 142 | ||
131 | static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist) | 143 | static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist) |
132 | { | 144 | { |
145 | #ifdef ROCKBOX | ||
146 | (void) x; | ||
147 | (void) glist; | ||
148 | #else /* ROCKBOX */ | ||
133 | if (glist_isvisible(glist)) | 149 | if (glist_isvisible(glist)) |
134 | { | 150 | { |
135 | if(x->x_gui.x_fsf.x_change) | 151 | if(x->x_gui.x_fsf.x_change) |
@@ -169,10 +185,15 @@ static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist) | |||
169 | x->x_buf[0] = 0; | 185 | x->x_buf[0] = 0; |
170 | } | 186 | } |
171 | } | 187 | } |
188 | #endif /* ROCKBOX */ | ||
172 | } | 189 | } |
173 | 190 | ||
174 | static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) | 191 | static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) |
175 | { | 192 | { |
193 | #ifdef ROCKBOX | ||
194 | (void) x; | ||
195 | (void) glist; | ||
196 | #else /* ROCKBOX */ | ||
176 | int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; | 197 | int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; |
177 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 198 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
178 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 199 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
@@ -215,10 +236,15 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) | |||
215 | xpos, ypos, | 236 | xpos, ypos, |
216 | xpos+IOWIDTH, ypos+1, | 237 | xpos+IOWIDTH, ypos+1, |
217 | x, 0); | 238 | x, 0); |
239 | #endif /* ROCKBOX */ | ||
218 | } | 240 | } |
219 | 241 | ||
220 | static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) | 242 | static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) |
221 | { | 243 | { |
244 | #ifdef ROCKBOX | ||
245 | (void) x; | ||
246 | (void) glist; | ||
247 | #else /* ROCKBOX */ | ||
222 | int half = x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; | 248 | int half = x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; |
223 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 249 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
224 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 250 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
@@ -248,10 +274,15 @@ static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) | |||
248 | canvas, x, 0, | 274 | canvas, x, 0, |
249 | xpos, ypos, | 275 | xpos, ypos, |
250 | xpos+IOWIDTH, ypos+1); | 276 | xpos+IOWIDTH, ypos+1); |
277 | #endif /* ROCKBOX */ | ||
251 | } | 278 | } |
252 | 279 | ||
253 | static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) | 280 | static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) |
254 | { | 281 | { |
282 | #ifdef ROCKBOX | ||
283 | (void) x; | ||
284 | (void) glist; | ||
285 | #else /* ROCKBOX */ | ||
255 | t_canvas *canvas=glist_getcanvas(glist); | 286 | t_canvas *canvas=glist_getcanvas(glist); |
256 | 287 | ||
257 | sys_vgui(".x%x.c delete %xBASE1\n", canvas, x); | 288 | sys_vgui(".x%x.c delete %xBASE1\n", canvas, x); |
@@ -262,10 +293,15 @@ static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) | |||
262 | sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); | 293 | sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); |
263 | if(!x->x_gui.x_fsf.x_rcv_able) | 294 | if(!x->x_gui.x_fsf.x_rcv_able) |
264 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 295 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
296 | #endif /* ROCKBOX */ | ||
265 | } | 297 | } |
266 | 298 | ||
267 | static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) | 299 | static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) |
268 | { | 300 | { |
301 | #ifdef ROCKBOX | ||
302 | (void) x; | ||
303 | (void) glist; | ||
304 | #else /* ROCKBOX */ | ||
269 | t_canvas *canvas=glist_getcanvas(glist); | 305 | t_canvas *canvas=glist_getcanvas(glist); |
270 | 306 | ||
271 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", | 307 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", |
@@ -279,10 +315,16 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) | |||
279 | x, x->x_gui.x_bcol); | 315 | x, x->x_gui.x_bcol); |
280 | sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", canvas, | 316 | sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", canvas, |
281 | x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); | 317 | x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); |
318 | #endif /* ROCKBOX */ | ||
282 | } | 319 | } |
283 | 320 | ||
284 | static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_flags) | 321 | static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_flags) |
285 | { | 322 | { |
323 | #ifdef ROCKBOX | ||
324 | (void) x; | ||
325 | (void) glist; | ||
326 | (void) old_snd_rcv_flags; | ||
327 | #else /* ROCKBOX */ | ||
286 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 328 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
287 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 329 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
288 | t_canvas *canvas=glist_getcanvas(glist); | 330 | t_canvas *canvas=glist_getcanvas(glist); |
@@ -303,10 +345,15 @@ static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_fla | |||
303 | x, 0); | 345 | x, 0); |
304 | if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) | 346 | if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) |
305 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 347 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
348 | #endif /* ROCKBOX */ | ||
306 | } | 349 | } |
307 | 350 | ||
308 | static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) | 351 | static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) |
309 | { | 352 | { |
353 | #ifdef ROCKBOX | ||
354 | (void) x; | ||
355 | (void) glist; | ||
356 | #else /* ROCKBOX */ | ||
310 | t_canvas *canvas=glist_getcanvas(glist); | 357 | t_canvas *canvas=glist_getcanvas(glist); |
311 | 358 | ||
312 | if(x->x_gui.x_fsf.x_selected) | 359 | if(x->x_gui.x_fsf.x_selected) |
@@ -338,6 +385,7 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) | |||
338 | sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", | 385 | sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", |
339 | canvas, x, x->x_gui.x_fcol); | 386 | canvas, x, x->x_gui.x_fcol); |
340 | } | 387 | } |
388 | #endif /* ROCKBOX */ | ||
341 | } | 389 | } |
342 | 390 | ||
343 | void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode) | 391 | void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode) |
@@ -440,6 +488,10 @@ int my_numbox_check_minmax(t_my_numbox *x, double min, double max) | |||
440 | 488 | ||
441 | static void my_numbox_properties(t_gobj *z, t_glist *owner) | 489 | static void my_numbox_properties(t_gobj *z, t_glist *owner) |
442 | { | 490 | { |
491 | #ifdef ROCKBOX | ||
492 | (void) z; | ||
493 | (void) owner; | ||
494 | #else /* ROCKBOX */ | ||
443 | t_my_numbox *x = (t_my_numbox *)z; | 495 | t_my_numbox *x = (t_my_numbox *)z; |
444 | char buf[800]; | 496 | char buf[800]; |
445 | t_symbol *srl[3]; | 497 | t_symbol *srl[3]; |
@@ -471,6 +523,7 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner) | |||
471 | 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, | 523 | 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, |
472 | 0xffffff & x->x_gui.x_lcol); | 524 | 0xffffff & x->x_gui.x_lcol); |
473 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); | 525 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); |
526 | #endif /* ROCKBOX */ | ||
474 | } | 527 | } |
475 | 528 | ||
476 | static void my_numbox_bang(t_my_numbox *x) | 529 | static void my_numbox_bang(t_my_numbox *x) |
@@ -492,6 +545,10 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, | |||
492 | int log_height = (int)atom_getintarg(6, argc, argv); | 545 | int log_height = (int)atom_getintarg(6, argc, argv); |
493 | int sr_flags; | 546 | int sr_flags; |
494 | 547 | ||
548 | #ifdef ROCKBOX | ||
549 | (void) s; | ||
550 | #endif | ||
551 | |||
495 | if(lilo != 0) lilo = 1; | 552 | if(lilo != 0) lilo = 1; |
496 | x->x_lin0_log1 = lilo; | 553 | x->x_lin0_log1 = lilo; |
497 | sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); | 554 | sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); |
@@ -519,6 +576,10 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) | |||
519 | { | 576 | { |
520 | double k2=1.0; | 577 | double k2=1.0; |
521 | 578 | ||
579 | #ifdef ROCKBOX | ||
580 | (void) dx; | ||
581 | #endif | ||
582 | |||
522 | if(x->x_gui.x_fsf.x_finemoved) | 583 | if(x->x_gui.x_fsf.x_finemoved) |
523 | k2 = 0.01; | 584 | k2 = 0.01; |
524 | if(x->x_lin0_log1) | 585 | if(x->x_lin0_log1) |
@@ -534,6 +595,11 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) | |||
534 | static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos, | 595 | static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos, |
535 | t_floatarg shift, t_floatarg ctrl, t_floatarg alt) | 596 | t_floatarg shift, t_floatarg ctrl, t_floatarg alt) |
536 | { | 597 | { |
598 | #ifdef ROCKBOX | ||
599 | (void) shift; | ||
600 | (void) ctrl; | ||
601 | (void) alt; | ||
602 | #endif | ||
537 | glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, | 603 | glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, |
538 | (t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos); | 604 | (t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos); |
539 | } | 605 | } |
@@ -543,6 +609,11 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist, | |||
543 | { | 609 | { |
544 | t_my_numbox* x = (t_my_numbox *)z; | 610 | t_my_numbox* x = (t_my_numbox *)z; |
545 | 611 | ||
612 | #ifdef ROCKBOX | ||
613 | (void) glist; | ||
614 | (void) dbl; | ||
615 | #endif | ||
616 | |||
546 | if(doit) | 617 | if(doit) |
547 | { | 618 | { |
548 | my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, | 619 | my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, |
@@ -603,6 +674,10 @@ static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) | |||
603 | { | 674 | { |
604 | int h, w; | 675 | int h, w; |
605 | 676 | ||
677 | #ifdef ROCKBOX | ||
678 | (void) s; | ||
679 | #endif | ||
680 | |||
606 | w = (int)atom_getintarg(0, ac, av); | 681 | w = (int)atom_getintarg(0, ac, av); |
607 | if(w < 1) | 682 | if(w < 1) |
608 | w = 1; | 683 | w = 1; |
@@ -626,6 +701,9 @@ static void my_numbox_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) | |||
626 | 701 | ||
627 | static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) | 702 | static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) |
628 | { | 703 | { |
704 | #ifdef ROCKBOX | ||
705 | (void) s; | ||
706 | #endif | ||
629 | if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av), | 707 | if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av), |
630 | (double)atom_getfloatarg(1, ac, av))) | 708 | (double)atom_getfloatarg(1, ac, av))) |
631 | { | 709 | { |
@@ -742,6 +820,9 @@ static void my_numbox_key(void *z, t_floatarg fkey) | |||
742 | 820 | ||
743 | static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) | 821 | static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) |
744 | { | 822 | { |
823 | #ifdef ROCKBOX | ||
824 | (void) s; | ||
825 | #endif | ||
745 | if (IS_A_FLOAT(av,0)) | 826 | if (IS_A_FLOAT(av,0)) |
746 | { | 827 | { |
747 | my_numbox_set(x, atom_getfloatarg(0, ac, av)); | 828 | my_numbox_set(x, atom_getfloatarg(0, ac, av)); |
@@ -754,11 +835,21 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) | |||
754 | t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class); | 835 | t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class); |
755 | int bflcol[]={-262144, -1, -1}; | 836 | int bflcol[]={-262144, -1, -1}; |
756 | int w=5, h=14; | 837 | int w=5, h=14; |
838 | #ifdef ROCKBOX | ||
839 | int lilo=0, ldx=0, ldy=-6; | ||
840 | #else | ||
757 | int lilo=0, f=0, ldx=0, ldy=-6; | 841 | int lilo=0, f=0, ldx=0, ldy=-6; |
842 | #endif | ||
758 | int fs=10; | 843 | int fs=10; |
759 | int log_height=256; | 844 | int log_height=256; |
760 | double min=-1.0e+37, max=1.0e+37,v=0.0; | 845 | double min=-1.0e+37, max=1.0e+37,v=0.0; |
846 | #ifndef ROCKBOX | ||
761 | char str[144]; | 847 | char str[144]; |
848 | #endif | ||
849 | |||
850 | #ifdef ROCKBOX | ||
851 | (void) s; | ||
852 | #endif | ||
762 | 853 | ||
763 | if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) | 854 | if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) |
764 | &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) | 855 | &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) |
@@ -843,7 +934,9 @@ static void my_numbox_free(t_my_numbox *x) | |||
843 | pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); | 934 | pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); |
844 | clock_free(x->x_clock_reset); | 935 | clock_free(x->x_clock_reset); |
845 | clock_free(x->x_clock_wait); | 936 | clock_free(x->x_clock_wait); |
937 | #ifndef ROCKBOX | ||
846 | gfxstub_deleteforkey(x); | 938 | gfxstub_deleteforkey(x); |
939 | #endif | ||
847 | } | 940 | } |
848 | 941 | ||
849 | void g_numbox_setup(void) | 942 | void g_numbox_setup(void) |