diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_canvas.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_canvas.c | 143 |
1 files changed, 134 insertions, 9 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_canvas.c b/apps/plugins/pdbox/PDa/src/g_canvas.c index f8b8dda0cf..19c10474c1 100644 --- a/apps/plugins/pdbox/PDa/src/g_canvas.c +++ b/apps/plugins/pdbox/PDa/src/g_canvas.c | |||
@@ -18,6 +18,15 @@ to be different but are now unified except for some fossilized names.) */ | |||
18 | * changes marked with IOhannes | 18 | * changes marked with IOhannes |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifdef ROCKBOX | ||
22 | #include "plugin.h" | ||
23 | #include "pdbox.h" | ||
24 | #include "m_pd.h" | ||
25 | #include "m_imp.h" | ||
26 | #include "s_stuff.h" | ||
27 | #include "g_canvas.h" | ||
28 | #include "g_all_guis.h" | ||
29 | #else /* ROCKBOX */ | ||
21 | #include <stdlib.h> | 30 | #include <stdlib.h> |
22 | #include <stdio.h> | 31 | #include <stdio.h> |
23 | #include "m_pd.h" | 32 | #include "m_pd.h" |
@@ -26,6 +35,7 @@ to be different but are now unified except for some fossilized names.) */ | |||
26 | #include "g_canvas.h" | 35 | #include "g_canvas.h" |
27 | #include <string.h> | 36 | #include <string.h> |
28 | #include "g_all_guis.h" | 37 | #include "g_all_guis.h" |
38 | #endif /* ROCKBOX */ | ||
29 | 39 | ||
30 | struct _canvasenvironment | 40 | struct _canvasenvironment |
31 | { | 41 | { |
@@ -83,7 +93,12 @@ static void glist_doupdatewindowlist(t_glist *gl, char *sbuf) | |||
83 | if (strlen(sbuf) + strlen(gl->gl_name->s_name) + 100 <= 1024) | 93 | if (strlen(sbuf) + strlen(gl->gl_name->s_name) + 100 <= 1024) |
84 | { | 94 | { |
85 | char tbuf[1024]; | 95 | char tbuf[1024]; |
96 | #ifdef ROCKBOX | ||
97 | snprintf(tbuf, sizeof(tbuf)-1, | ||
98 | "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); | ||
99 | #else /* ROCKBOX */ | ||
86 | sprintf(tbuf, "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); | 100 | sprintf(tbuf, "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); |
101 | #endif /* ROCKBOX */ | ||
87 | strcat(sbuf, tbuf); | 102 | strcat(sbuf, tbuf); |
88 | } | 103 | } |
89 | } | 104 | } |
@@ -107,7 +122,9 @@ void canvas_updatewindowlist( void) | |||
107 | glist_doupdatewindowlist(x, sbuf); | 122 | glist_doupdatewindowlist(x, sbuf); |
108 | /* next line updates the window menu state before -postcommand tries it */ | 123 | /* next line updates the window menu state before -postcommand tries it */ |
109 | strcat(sbuf, "}\npdtk_fixwindowmenu\n"); | 124 | strcat(sbuf, "}\npdtk_fixwindowmenu\n"); |
125 | #ifndef ROCKBOX | ||
110 | sys_gui(sbuf); | 126 | sys_gui(sbuf); |
127 | #endif | ||
111 | } | 128 | } |
112 | 129 | ||
113 | /* add a glist the list of "root" canvases (toplevels without parents.) */ | 130 | /* add a glist the list of "root" canvases (toplevels without parents.) */ |
@@ -144,6 +161,9 @@ void canvas_setargs(int argc, t_atom *argv) | |||
144 | 161 | ||
145 | void glob_setfilename(void *dummy, t_symbol *filesym, t_symbol *dirsym) | 162 | void glob_setfilename(void *dummy, t_symbol *filesym, t_symbol *dirsym) |
146 | { | 163 | { |
164 | #ifdef ROCKBOX | ||
165 | (void) dummy; | ||
166 | #endif | ||
147 | canvas_newfilename = filesym; | 167 | canvas_newfilename = filesym; |
148 | canvas_newdirectory = dirsym; | 168 | canvas_newdirectory = dirsym; |
149 | } | 169 | } |
@@ -286,7 +306,7 @@ t_outconnect *linetraverser_next(t_linetraverser *t) | |||
286 | if (!t->tr_ob) y = t->tr_x->gl_list; | 306 | if (!t->tr_ob) y = t->tr_x->gl_list; |
287 | else y = t->tr_ob->ob_g.g_next; | 307 | else y = t->tr_ob->ob_g.g_next; |
288 | for (; y; y = y->g_next) | 308 | for (; y; y = y->g_next) |
289 | if (ob = pd_checkobject(&y->g_pd)) break; | 309 | if((ob = pd_checkobject(&y->g_pd))) break; |
290 | if (!ob) return (0); | 310 | if (!ob) return (0); |
291 | t->tr_ob = ob; | 311 | t->tr_ob = ob; |
292 | t->tr_nout = obj_noutlets(ob); | 312 | t->tr_nout = obj_noutlets(ob); |
@@ -357,7 +377,13 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) | |||
357 | t_symbol *s = &s_; | 377 | t_symbol *s = &s_; |
358 | int vis = 0, width = GLIST_DEFCANVASWIDTH, height = GLIST_DEFCANVASHEIGHT; | 378 | int vis = 0, width = GLIST_DEFCANVASWIDTH, height = GLIST_DEFCANVASHEIGHT; |
359 | int xloc = 0, yloc = GLIST_DEFCANVASYLOC; | 379 | int xloc = 0, yloc = GLIST_DEFCANVASYLOC; |
380 | #ifdef ROCKBOX | ||
381 | (void) dummy; | ||
382 | (void) sel; | ||
383 | int font = 10; | ||
384 | #else /* ROCKBOX */ | ||
360 | int font = (owner ? owner->gl_font : sys_defaultfont); | 385 | int font = (owner ? owner->gl_font : sys_defaultfont); |
386 | #endif /* ROCKBOX */ | ||
361 | glist_init(x); | 387 | glist_init(x); |
362 | x->gl_obj.te_type = T_OBJECT; | 388 | x->gl_obj.te_type = T_OBJECT; |
363 | if (!owner) | 389 | if (!owner) |
@@ -415,7 +441,11 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) | |||
415 | x->gl_loading = 1; | 441 | x->gl_loading = 1; |
416 | x->gl_willvis = vis; | 442 | x->gl_willvis = vis; |
417 | x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8); | 443 | x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8); |
444 | #ifdef ROCKBOX | ||
445 | x->gl_font = 10; | ||
446 | #else /* ROCKBOX */ | ||
418 | x->gl_font = sys_nearestfontsize(font); | 447 | x->gl_font = sys_nearestfontsize(font); |
448 | #endif /* ROCKBOX */ | ||
419 | pd_pushsym(&x->gl_pd); | 449 | pd_pushsym(&x->gl_pd); |
420 | return(x); | 450 | return(x); |
421 | } | 451 | } |
@@ -424,6 +454,9 @@ void canvas_setgraph(t_glist *x, int flag); | |||
424 | 454 | ||
425 | static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv) | 455 | static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv) |
426 | { | 456 | { |
457 | #ifdef ROCKBOX | ||
458 | (void) s; | ||
459 | #endif | ||
427 | x->gl_x1 = atom_getfloatarg(0, argc, argv); | 460 | x->gl_x1 = atom_getfloatarg(0, argc, argv); |
428 | x->gl_y1 = atom_getfloatarg(1, argc, argv); | 461 | x->gl_y1 = atom_getfloatarg(1, argc, argv); |
429 | x->gl_x2 = atom_getfloatarg(2, argc, argv); | 462 | x->gl_x2 = atom_getfloatarg(2, argc, argv); |
@@ -449,7 +482,11 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, | |||
449 | if (!*sym->s_name) | 482 | if (!*sym->s_name) |
450 | { | 483 | { |
451 | char buf[40]; | 484 | char buf[40]; |
485 | #ifdef ROCKBOX | ||
486 | snprintf(buf, sizeof(buf)-1, "graph%d", ++gcount); | ||
487 | #else /* ROCKBOX */ | ||
452 | sprintf(buf, "graph%d", ++gcount); | 488 | sprintf(buf, "graph%d", ++gcount); |
489 | #endif /* ROCKBOX */ | ||
453 | sym = gensym(buf); | 490 | sym = gensym(buf); |
454 | menu = 1; | 491 | menu = 1; |
455 | } | 492 | } |
@@ -484,8 +521,12 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, | |||
484 | x->gl_obj.te_ypix = py1; | 521 | x->gl_obj.te_ypix = py1; |
485 | x->gl_pixwidth = px2 - px1; | 522 | x->gl_pixwidth = px2 - px1; |
486 | x->gl_pixheight = py2 - py1; | 523 | x->gl_pixheight = py2 - py1; |
524 | #ifdef ROCKBOX | ||
525 | x->gl_font = 10; | ||
526 | #else /* ROCKBOX */ | ||
487 | x->gl_font = (canvas_getcurrent() ? | 527 | x->gl_font = (canvas_getcurrent() ? |
488 | canvas_getcurrent()->gl_font : sys_defaultfont); | 528 | canvas_getcurrent()->gl_font : sys_defaultfont); |
529 | #endif /* ROCKBOX */ | ||
489 | x->gl_screenx1 = x->gl_screeny1 = 0; | 530 | x->gl_screenx1 = x->gl_screeny1 = 0; |
490 | x->gl_screenx2 = 240; | 531 | x->gl_screenx2 = 240; |
491 | x->gl_screeny2 = 300; | 532 | x->gl_screeny2 = 300; |
@@ -507,6 +548,9 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, | |||
507 | /* call glist_addglist from a Pd message */ | 548 | /* call glist_addglist from a Pd message */ |
508 | void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv) | 549 | void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv) |
509 | { | 550 | { |
551 | #ifdef ROCKBOX | ||
552 | (void) s; | ||
553 | #endif | ||
510 | t_symbol *sym = atom_getsymbolarg(0, argc, argv); | 554 | t_symbol *sym = atom_getsymbolarg(0, argc, argv); |
511 | float x1 = atom_getfloatarg(1, argc, argv); | 555 | float x1 = atom_getfloatarg(1, argc, argv); |
512 | float y1 = atom_getfloatarg(2, argc, argv); | 556 | float y1 = atom_getfloatarg(2, argc, argv); |
@@ -584,9 +628,11 @@ void canvas_reflecttitle(t_canvas *x) | |||
584 | strcat(namebuf, ")"); | 628 | strcat(namebuf, ")"); |
585 | } | 629 | } |
586 | else namebuf[0] = 0; | 630 | else namebuf[0] = 0; |
631 | #ifndef ROCKBOX | ||
587 | sys_vgui("wm title .x%x {%s%c%s - %s}\n", | 632 | sys_vgui("wm title .x%x {%s%c%s - %s}\n", |
588 | x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf, | 633 | x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf, |
589 | canvas_getdir(x)->s_name); | 634 | canvas_getdir(x)->s_name); |
635 | #endif | ||
590 | } | 636 | } |
591 | 637 | ||
592 | void canvas_dirty(t_canvas *x, t_int n) | 638 | void canvas_dirty(t_canvas *x, t_int n) |
@@ -624,7 +670,9 @@ void canvas_map(t_canvas *x, t_floatarg f) | |||
624 | canvas_drawlines(x); | 670 | canvas_drawlines(x); |
625 | /* simulate a mouse up so u_main will calculate scrollbars... | 671 | /* simulate a mouse up so u_main will calculate scrollbars... |
626 | ugly! */ | 672 | ugly! */ |
673 | #ifndef ROCKBOX | ||
627 | sys_vgui("pdtk_canvas_mouseup .x%x.c 0 0 0\n", x); | 674 | sys_vgui("pdtk_canvas_mouseup .x%x.c 0 0 0\n", x); |
675 | #endif | ||
628 | } | 676 | } |
629 | } | 677 | } |
630 | else | 678 | else |
@@ -632,7 +680,9 @@ void canvas_map(t_canvas *x, t_floatarg f) | |||
632 | if (glist_isvisible(x)) | 680 | if (glist_isvisible(x)) |
633 | { | 681 | { |
634 | /* just clear out the whole canvas... */ | 682 | /* just clear out the whole canvas... */ |
683 | #ifndef ROCKBOX | ||
635 | sys_vgui(".x%x.c delete all\n", x); | 684 | sys_vgui(".x%x.c delete all\n", x); |
685 | #endif | ||
636 | /* alternatively, we could have erased them one by one... | 686 | /* alternatively, we could have erased them one by one... |
637 | for (y = x->gl_list; y; y = y->g_next) | 687 | for (y = x->gl_list; y; y = y->g_next) |
638 | gobj_vis(y, x, 0); | 688 | gobj_vis(y, x, 0); |
@@ -661,7 +711,11 @@ static t_editor *editor_new(t_glist *owner) | |||
661 | x->e_connectbuf = binbuf_new(); | 711 | x->e_connectbuf = binbuf_new(); |
662 | x->e_deleted = binbuf_new(); | 712 | x->e_deleted = binbuf_new(); |
663 | x->e_glist = owner; | 713 | x->e_glist = owner; |
714 | #ifdef ROCKBOX | ||
715 | snprintf(buf, sizeof(buf)-1, ".x%x", (t_int)owner); | ||
716 | #else /* ROCKBOX */ | ||
664 | sprintf(buf, ".x%x", (t_int)owner); | 717 | sprintf(buf, ".x%x", (t_int)owner); |
718 | #endif /* ROCKBOX */ | ||
665 | x->e_guiconnect = guiconnect_new(&owner->gl_pd, gensym(buf)); | 719 | x->e_guiconnect = guiconnect_new(&owner->gl_pd, gensym(buf)); |
666 | return (x); | 720 | return (x); |
667 | } | 721 | } |
@@ -689,7 +743,7 @@ void canvas_create_editor(t_glist *x, int createit) | |||
689 | { | 743 | { |
690 | x->gl_editor = editor_new(x); | 744 | x->gl_editor = editor_new(x); |
691 | for (y = x->gl_list; y; y = y->g_next) | 745 | for (y = x->gl_list; y; y = y->g_next) |
692 | if (ob = pd_checkobject(&y->g_pd)) | 746 | if((ob = pd_checkobject(&y->g_pd))) |
693 | rtext_new(x, ob); | 747 | rtext_new(x, ob); |
694 | } | 748 | } |
695 | } | 749 | } |
@@ -700,7 +754,7 @@ void canvas_create_editor(t_glist *x, int createit) | |||
700 | else | 754 | else |
701 | { | 755 | { |
702 | for (y = x->gl_list; y; y = y->g_next) | 756 | for (y = x->gl_list; y; y = y->g_next) |
703 | if (ob = pd_checkobject(&y->g_pd)) | 757 | if((ob = pd_checkobject(&y->g_pd))) |
704 | rtext_free(glist_findrtext(x, ob)); | 758 | rtext_free(glist_findrtext(x, ob)); |
705 | editor_free(x->gl_editor, x); | 759 | editor_free(x->gl_editor, x); |
706 | x->gl_editor = 0; | 760 | x->gl_editor = 0; |
@@ -717,7 +771,9 @@ void canvas_create_editor(t_glist *x, int createit) | |||
717 | the window. */ | 771 | the window. */ |
718 | void canvas_vis(t_canvas *x, t_floatarg f) | 772 | void canvas_vis(t_canvas *x, t_floatarg f) |
719 | { | 773 | { |
774 | #ifndef ROCKBOX | ||
720 | char buf[30]; | 775 | char buf[30]; |
776 | #endif | ||
721 | int flag = (f != 0); | 777 | int flag = (f != 0); |
722 | if (flag) | 778 | if (flag) |
723 | { | 779 | { |
@@ -728,19 +784,23 @@ void canvas_vis(t_canvas *x, t_floatarg f) | |||
728 | canvas_vis(x, 0); | 784 | canvas_vis(x, 0); |
729 | canvas_vis(x, 1); | 785 | canvas_vis(x, 1); |
730 | #else | 786 | #else |
787 | #ifndef ROCKBOX | ||
731 | sys_vgui("raise .x%x\n", x); | 788 | sys_vgui("raise .x%x\n", x); |
732 | sys_vgui("focus .x%x.c\n", x); | 789 | sys_vgui("focus .x%x.c\n", x); |
733 | sys_vgui("wm deiconify .x%x\n", x); | 790 | sys_vgui("wm deiconify .x%x\n", x); |
791 | #endif /* ROCKBOX */ | ||
734 | #endif | 792 | #endif |
735 | } | 793 | } |
736 | else | 794 | else |
737 | { | 795 | { |
738 | canvas_create_editor(x, 1); | 796 | canvas_create_editor(x, 1); |
797 | #ifndef ROCKBOX | ||
739 | sys_vgui("pdtk_canvas_new .x%x %d %d +%d+%d %d\n", x, | 798 | sys_vgui("pdtk_canvas_new .x%x %d %d +%d+%d %d\n", x, |
740 | (int)(x->gl_screenx2 - x->gl_screenx1), | 799 | (int)(x->gl_screenx2 - x->gl_screenx1), |
741 | (int)(x->gl_screeny2 - x->gl_screeny1), | 800 | (int)(x->gl_screeny2 - x->gl_screeny1), |
742 | (int)(x->gl_screenx1), (int)(x->gl_screeny1), | 801 | (int)(x->gl_screenx1), (int)(x->gl_screeny1), |
743 | x->gl_edit); | 802 | x->gl_edit); |
803 | #endif /* ROCKBOX */ | ||
744 | canvas_reflecttitle(x); | 804 | canvas_reflecttitle(x); |
745 | x->gl_havewindow = 1; | 805 | x->gl_havewindow = 1; |
746 | canvas_updatewindowlist(); | 806 | canvas_updatewindowlist(); |
@@ -765,10 +825,14 @@ void canvas_vis(t_canvas *x, t_floatarg f) | |||
765 | if (glist_isvisible(x)) | 825 | if (glist_isvisible(x)) |
766 | canvas_map(x, 0); | 826 | canvas_map(x, 0); |
767 | canvas_create_editor(x, 0); | 827 | canvas_create_editor(x, 0); |
828 | #ifndef ROCKBOX | ||
768 | sys_vgui("destroy .x%x\n", x); | 829 | sys_vgui("destroy .x%x\n", x); |
830 | #endif | ||
769 | for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++) | 831 | for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++) |
770 | ; | 832 | ; |
833 | #ifndef ROCKBOX | ||
771 | sys_vgui(".mbar.find delete %d\n", i); | 834 | sys_vgui(".mbar.find delete %d\n", i); |
835 | #endif | ||
772 | /* if we're a graph on our parent, and if the parent exists | 836 | /* if we're a graph on our parent, and if the parent exists |
773 | and is visible, show ourselves on parent. */ | 837 | and is visible, show ourselves on parent. */ |
774 | if (glist_isgraph(x) && x->gl_owner) | 838 | if (glist_isgraph(x) && x->gl_owner) |
@@ -837,7 +901,7 @@ void canvas_free(t_canvas *x) | |||
837 | if (canvas_whichfind == x) | 901 | if (canvas_whichfind == x) |
838 | canvas_whichfind = 0; | 902 | canvas_whichfind = 0; |
839 | glist_noselect(x); | 903 | glist_noselect(x); |
840 | while (y = x->gl_list) | 904 | while((y = x->gl_list)) |
841 | glist_delete(x, y); | 905 | glist_delete(x, y); |
842 | canvas_vis(x, 0); | 906 | canvas_vis(x, 0); |
843 | 907 | ||
@@ -850,7 +914,9 @@ void canvas_free(t_canvas *x) | |||
850 | } | 914 | } |
851 | canvas_resume_dsp(dspstate); | 915 | canvas_resume_dsp(dspstate); |
852 | glist_cleanup(x); | 916 | glist_cleanup(x); |
917 | #ifndef ROCKBOX | ||
853 | gfxstub_deleteforkey(x); /* probably unnecessary */ | 918 | gfxstub_deleteforkey(x); /* probably unnecessary */ |
919 | #endif | ||
854 | if (!x->gl_owner) | 920 | if (!x->gl_owner) |
855 | canvas_takeofflist(x); | 921 | canvas_takeofflist(x); |
856 | } | 922 | } |
@@ -863,12 +929,16 @@ static void canvas_drawlines(t_canvas *x) | |||
863 | t_outconnect *oc; | 929 | t_outconnect *oc; |
864 | { | 930 | { |
865 | linetraverser_start(&t, x); | 931 | linetraverser_start(&t, x); |
866 | while (oc = linetraverser_next(&t)) | 932 | while((oc = linetraverser_next(&t))) |
933 | #ifdef ROCKBOX | ||
934 | ; | ||
935 | #else /* ROCKBOX */ | ||
867 | sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", | 936 | sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", |
868 | glist_getcanvas(x), | 937 | glist_getcanvas(x), |
869 | t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, | 938 | t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, |
870 | (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1), | 939 | (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1), |
871 | oc); | 940 | oc); |
941 | #endif /* ROCKBOX */ | ||
872 | } | 942 | } |
873 | } | 943 | } |
874 | 944 | ||
@@ -878,13 +948,15 @@ void canvas_fixlinesfor(t_canvas *x, t_text *text) | |||
878 | t_outconnect *oc; | 948 | t_outconnect *oc; |
879 | 949 | ||
880 | linetraverser_start(&t, x); | 950 | linetraverser_start(&t, x); |
881 | while (oc = linetraverser_next(&t)) | 951 | while((oc = linetraverser_next(&t))) |
882 | { | 952 | { |
883 | if (t.tr_ob == text || t.tr_ob2 == text) | 953 | if (t.tr_ob == text || t.tr_ob2 == text) |
884 | { | 954 | { |
955 | #ifndef ROCKBOX | ||
885 | sys_vgui(".x%x.c coords l%x %d %d %d %d\n", | 956 | sys_vgui(".x%x.c coords l%x %d %d %d %d\n", |
886 | glist_getcanvas(x), oc, | 957 | glist_getcanvas(x), oc, |
887 | t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2); | 958 | t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2); |
959 | #endif | ||
888 | } | 960 | } |
889 | } | 961 | } |
890 | } | 962 | } |
@@ -895,14 +967,16 @@ void canvas_deletelinesfor(t_canvas *x, t_text *text) | |||
895 | t_linetraverser t; | 967 | t_linetraverser t; |
896 | t_outconnect *oc; | 968 | t_outconnect *oc; |
897 | linetraverser_start(&t, x); | 969 | linetraverser_start(&t, x); |
898 | while (oc = linetraverser_next(&t)) | 970 | while((oc = linetraverser_next(&t))) |
899 | { | 971 | { |
900 | if (t.tr_ob == text || t.tr_ob2 == text) | 972 | if (t.tr_ob == text || t.tr_ob2 == text) |
901 | { | 973 | { |
902 | if (x->gl_editor) | 974 | if (x->gl_editor) |
903 | { | 975 | { |
976 | #ifndef ROCKBOX | ||
904 | sys_vgui(".x%x.c delete l%x\n", | 977 | sys_vgui(".x%x.c delete l%x\n", |
905 | glist_getcanvas(x), oc); | 978 | glist_getcanvas(x), oc); |
979 | #endif | ||
906 | } | 980 | } |
907 | obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); | 981 | obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); |
908 | } | 982 | } |
@@ -916,15 +990,17 @@ void canvas_deletelinesforio(t_canvas *x, t_text *text, | |||
916 | t_linetraverser t; | 990 | t_linetraverser t; |
917 | t_outconnect *oc; | 991 | t_outconnect *oc; |
918 | linetraverser_start(&t, x); | 992 | linetraverser_start(&t, x); |
919 | while (oc = linetraverser_next(&t)) | 993 | while((oc = linetraverser_next(&t))) |
920 | { | 994 | { |
921 | if ((t.tr_ob == text && t.tr_outlet == outp) || | 995 | if ((t.tr_ob == text && t.tr_outlet == outp) || |
922 | (t.tr_ob2 == text && t.tr_inlet == inp)) | 996 | (t.tr_ob2 == text && t.tr_inlet == inp)) |
923 | { | 997 | { |
924 | if (x->gl_editor) | 998 | if (x->gl_editor) |
925 | { | 999 | { |
1000 | #ifndef ROCKBOX | ||
926 | sys_vgui(".x%x.c delete l%x\n", | 1001 | sys_vgui(".x%x.c delete l%x\n", |
927 | glist_getcanvas(x), oc); | 1002 | glist_getcanvas(x), oc); |
1003 | #endif | ||
928 | } | 1004 | } |
929 | obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); | 1005 | obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); |
930 | } | 1006 | } |
@@ -947,6 +1023,9 @@ void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv); | |||
947 | void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv) | 1023 | void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv) |
948 | { /* IOhannes */ | 1024 | { /* IOhannes */ |
949 | t_pd *z; | 1025 | t_pd *z; |
1026 | #ifdef ROCKBOX | ||
1027 | (void) s; | ||
1028 | #endif | ||
950 | /* this should be unnecessary, but sometimes the canvas's name gets | 1029 | /* this should be unnecessary, but sometimes the canvas's name gets |
951 | out of sync with the owning box's argument; this fixes that */ | 1030 | out of sync with the owning box's argument; this fixes that */ |
952 | if (argc > 3) | 1031 | if (argc > 3) |
@@ -992,7 +1071,9 @@ void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv) | |||
992 | static void canvas_loadbangabstractions(t_canvas *x) | 1071 | static void canvas_loadbangabstractions(t_canvas *x) |
993 | { | 1072 | { |
994 | t_gobj *y; | 1073 | t_gobj *y; |
1074 | #ifndef ROCKBOX | ||
995 | t_symbol *s = gensym("loadbang"); | 1075 | t_symbol *s = gensym("loadbang"); |
1076 | #endif | ||
996 | for (y = x->gl_list; y; y = y->g_next) | 1077 | for (y = x->gl_list; y; y = y->g_next) |
997 | if (pd_class(&y->g_pd) == canvas_class) | 1078 | if (pd_class(&y->g_pd) == canvas_class) |
998 | { | 1079 | { |
@@ -1021,7 +1102,9 @@ void canvas_loadbangsubpatches(t_canvas *x) | |||
1021 | 1102 | ||
1022 | void canvas_loadbang(t_canvas *x) | 1103 | void canvas_loadbang(t_canvas *x) |
1023 | { | 1104 | { |
1105 | #ifndef ROCKBOX | ||
1024 | t_gobj *y; | 1106 | t_gobj *y; |
1107 | #endif | ||
1025 | canvas_loadbangabstractions(x); | 1108 | canvas_loadbangabstractions(x); |
1026 | canvas_loadbangsubpatches(x); | 1109 | canvas_loadbangsubpatches(x); |
1027 | } | 1110 | } |
@@ -1042,6 +1125,11 @@ void canvas_loadbang(t_canvas *x) | |||
1042 | static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom, | 1125 | static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom, |
1043 | t_symbol *topgeom) | 1126 | t_symbol *topgeom) |
1044 | { | 1127 | { |
1128 | #ifdef ROCKBOX | ||
1129 | (void) x; | ||
1130 | (void) canvasgeom; | ||
1131 | (void) topgeom; | ||
1132 | #else /* ROCKBOX */ | ||
1045 | int cxpix, cypix, cw, ch, txpix, typix, tw, th; | 1133 | int cxpix, cypix, cw, ch, txpix, typix, tw, th; |
1046 | if (sscanf(canvasgeom->s_name, "%dx%d+%d+%d", &cw, &ch, &cxpix, &cypix) | 1134 | if (sscanf(canvasgeom->s_name, "%dx%d+%d+%d", &cw, &ch, &cxpix, &cypix) |
1047 | < 4 || | 1135 | < 4 || |
@@ -1052,6 +1140,7 @@ static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom, | |||
1052 | if (cw > 5 && ch > 5) | 1140 | if (cw > 5 && ch > 5) |
1053 | canvas_setbounds(x, txpix, typix, | 1141 | canvas_setbounds(x, txpix, typix, |
1054 | txpix + cw - HORIZBORDER, typix + ch - VERTBORDER); | 1142 | txpix + cw - HORIZBORDER, typix + ch - VERTBORDER); |
1143 | #endif /* ROCKBOX */ | ||
1055 | } | 1144 | } |
1056 | 1145 | ||
1057 | void canvas_popabstraction(t_canvas *x) | 1146 | void canvas_popabstraction(t_canvas *x) |
@@ -1065,6 +1154,9 @@ void canvas_popabstraction(t_canvas *x) | |||
1065 | 1154 | ||
1066 | void canvas_logerror(t_object *y) | 1155 | void canvas_logerror(t_object *y) |
1067 | { | 1156 | { |
1157 | #ifdef ROCKBOX | ||
1158 | (void) y; | ||
1159 | #endif | ||
1068 | #ifdef LATER | 1160 | #ifdef LATER |
1069 | canvas_vis(x, 1); | 1161 | canvas_vis(x, 1); |
1070 | if (!glist_isselected(x, &y->ob_g)) | 1162 | if (!glist_isselected(x, &y->ob_g)) |
@@ -1095,6 +1187,13 @@ static void canvas_click(t_canvas *x, | |||
1095 | t_floatarg xpos, t_floatarg ypos, | 1187 | t_floatarg xpos, t_floatarg ypos, |
1096 | t_floatarg shift, t_floatarg ctrl, t_floatarg alt) | 1188 | t_floatarg shift, t_floatarg ctrl, t_floatarg alt) |
1097 | { | 1189 | { |
1190 | #ifdef ROCKBOX | ||
1191 | (void) xpos; | ||
1192 | (void) ypos; | ||
1193 | (void) shift; | ||
1194 | (void) ctrl; | ||
1195 | (void) alt; | ||
1196 | #endif | ||
1098 | canvas_vis(x, 1); | 1197 | canvas_vis(x, 1); |
1099 | } | 1198 | } |
1100 | 1199 | ||
@@ -1103,13 +1202,22 @@ static void canvas_click(t_canvas *x, | |||
1103 | void canvas_fattensub(t_canvas *x, | 1202 | void canvas_fattensub(t_canvas *x, |
1104 | int *xp1, int *yp1, int *xp2, int *yp2) | 1203 | int *xp1, int *yp1, int *xp2, int *yp2) |
1105 | { | 1204 | { |
1205 | #ifdef ROCKBOX | ||
1206 | (void) x; | ||
1207 | (void) xp1; | ||
1208 | (void) yp1; | ||
1209 | #else /* ROCKBOX */ | ||
1106 | t_gobj *y; | 1210 | t_gobj *y; |
1211 | #endif /* ROCKBOX */ | ||
1107 | *xp2 += 50; /* fake for now */ | 1212 | *xp2 += 50; /* fake for now */ |
1108 | *yp2 += 50; | 1213 | *yp2 += 50; |
1109 | } | 1214 | } |
1110 | 1215 | ||
1111 | static void canvas_rename_method(t_canvas *x, t_symbol *s, int ac, t_atom *av) | 1216 | static void canvas_rename_method(t_canvas *x, t_symbol *s, int ac, t_atom *av) |
1112 | { | 1217 | { |
1218 | #ifdef ROCKBOX | ||
1219 | (void) s; | ||
1220 | #endif | ||
1113 | if (ac && av->a_type == A_SYMBOL) | 1221 | if (ac && av->a_type == A_SYMBOL) |
1114 | canvas_rename(x, av->a_w.w_symbol, 0); | 1222 | canvas_rename(x, av->a_w.w_symbol, 0); |
1115 | else canvas_rename(x, gensym("Pd"), 0); | 1223 | else canvas_rename(x, gensym("Pd"), 0); |
@@ -1128,7 +1236,11 @@ static void *table_new(t_symbol *s, t_floatarg f) | |||
1128 | { | 1236 | { |
1129 | char tabname[255]; | 1237 | char tabname[255]; |
1130 | t_symbol *t = gensym("table"); | 1238 | t_symbol *t = gensym("table"); |
1239 | #ifdef ROCKBOX | ||
1240 | snprintf(tabname, sizeof(tabname)-1, "%s%d", t->s_name, tabcount++); | ||
1241 | #else /* ROCKBOX */ | ||
1131 | sprintf(tabname, "%s%d", t->s_name, tabcount++); | 1242 | sprintf(tabname, "%s%d", t->s_name, tabcount++); |
1243 | #endif /* ROCKBOX */ | ||
1132 | s = gensym(tabname); | 1244 | s = gensym(tabname); |
1133 | } | 1245 | } |
1134 | if (f <= 1) | 1246 | if (f <= 1) |
@@ -1239,7 +1351,7 @@ static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp) | |||
1239 | 1351 | ||
1240 | /* ... and all dsp interconnections */ | 1352 | /* ... and all dsp interconnections */ |
1241 | linetraverser_start(&t, x); | 1353 | linetraverser_start(&t, x); |
1242 | while (oc = linetraverser_next(&t)) | 1354 | while((oc = linetraverser_next(&t))) |
1243 | if (obj_issignaloutlet(t.tr_ob, t.tr_outno)) | 1355 | if (obj_issignaloutlet(t.tr_ob, t.tr_outno)) |
1244 | ugen_connect(dc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); | 1356 | ugen_connect(dc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); |
1245 | 1357 | ||
@@ -1252,7 +1364,9 @@ static void canvas_start_dsp(void) | |||
1252 | { | 1364 | { |
1253 | t_canvas *x; | 1365 | t_canvas *x; |
1254 | if (canvas_dspstate) ugen_stop(); | 1366 | if (canvas_dspstate) ugen_stop(); |
1367 | #ifndef ROCKBOX | ||
1255 | else sys_gui("pdtk_pd_dsp ON\n"); | 1368 | else sys_gui("pdtk_pd_dsp ON\n"); |
1369 | #endif | ||
1256 | ugen_start(); | 1370 | ugen_start(); |
1257 | 1371 | ||
1258 | for (x = canvas_list; x; x = x->gl_next) | 1372 | for (x = canvas_list; x; x = x->gl_next) |
@@ -1266,7 +1380,9 @@ static void canvas_stop_dsp(void) | |||
1266 | if (canvas_dspstate) | 1380 | if (canvas_dspstate) |
1267 | { | 1381 | { |
1268 | ugen_stop(); | 1382 | ugen_stop(); |
1383 | #ifndef ROCKBOX | ||
1269 | sys_gui("pdtk_pd_dsp OFF\n"); | 1384 | sys_gui("pdtk_pd_dsp OFF\n"); |
1385 | #endif | ||
1270 | canvas_dspstate = 0; | 1386 | canvas_dspstate = 0; |
1271 | } | 1387 | } |
1272 | } | 1388 | } |
@@ -1297,6 +1413,10 @@ void canvas_update_dsp(void) | |||
1297 | void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv) | 1413 | void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv) |
1298 | { | 1414 | { |
1299 | int newstate; | 1415 | int newstate; |
1416 | #ifdef ROCKBOX | ||
1417 | (void) dummy; | ||
1418 | (void) s; | ||
1419 | #endif | ||
1300 | if (argc) | 1420 | if (argc) |
1301 | { | 1421 | { |
1302 | newstate = atom_getintarg(0, argc, argv); | 1422 | newstate = atom_getintarg(0, argc, argv); |
@@ -1333,7 +1453,9 @@ static void glist_redrawall(t_glist *gl) | |||
1333 | int vis = glist_isvisible(gl); | 1453 | int vis = glist_isvisible(gl); |
1334 | for (g = gl->gl_list; g; g = g->g_next) | 1454 | for (g = gl->gl_list; g; g = g->g_next) |
1335 | { | 1455 | { |
1456 | #ifndef ROCKBOX | ||
1336 | t_class *cl; | 1457 | t_class *cl; |
1458 | #endif | ||
1337 | if (vis && g->g_pd == scalar_class) | 1459 | if (vis && g->g_pd == scalar_class) |
1338 | glist_redrawitem(gl, g); | 1460 | glist_redrawitem(gl, g); |
1339 | else if (g->g_pd == canvas_class) | 1461 | else if (g->g_pd == canvas_class) |
@@ -1345,6 +1467,9 @@ static void glist_redrawall(t_glist *gl) | |||
1345 | void canvas_redrawallfortemplate(t_canvas *templatecanvas) | 1467 | void canvas_redrawallfortemplate(t_canvas *templatecanvas) |
1346 | { | 1468 | { |
1347 | t_canvas *x; | 1469 | t_canvas *x; |
1470 | #ifdef ROCKBOX | ||
1471 | (void) templatecanvas; | ||
1472 | #endif | ||
1348 | /* find all root canvases */ | 1473 | /* find all root canvases */ |
1349 | for (x = canvas_list; x; x = x->gl_next) | 1474 | for (x = canvas_list; x; x = x->gl_next) |
1350 | glist_redrawall(x); | 1475 | glist_redrawall(x); |