summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/g_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_template.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/g_template.c222
1 files changed, 217 insertions, 5 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_template.c b/apps/plugins/pdbox/PDa/src/g_template.c
index 9e62c0f1d2..deb47c3129 100644
--- a/apps/plugins/pdbox/PDa/src/g_template.c
+++ b/apps/plugins/pdbox/PDa/src/g_template.c
@@ -2,6 +2,14 @@
2* For information on usage and redistribution, and for a DISCLAIMER OF ALL 2* For information on usage and redistribution, and for a DISCLAIMER OF ALL
3* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ 3* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
4 4
5#ifdef ROCKBOX
6#include "plugin.h"
7#include "pdbox.h"
8#include "m_pd.h"
9#include "s_stuff.h"
10#include "g_canvas.h"
11#define snprintf rb->snprintf
12#else /* ROCKBOX */
5#include <stdlib.h> 13#include <stdlib.h>
6#include <string.h> 14#include <string.h>
7#include <stdio.h> 15#include <stdio.h>
@@ -9,6 +17,7 @@
9#include "m_pd.h" 17#include "m_pd.h"
10#include "s_stuff.h" /* for sys_hostfontsize */ 18#include "s_stuff.h" /* for sys_hostfontsize */
11#include "g_canvas.h" 19#include "g_canvas.h"
20#endif /* ROCKBOX */
12 21
13/* 22/*
14This file contains text objects you would put in a canvas to define a 23This file contains text objects you would put in a canvas to define a
@@ -140,7 +149,9 @@ int template_size(t_template *x)
140int template_find_field(t_template *x, t_symbol *name, int *p_onset, 149int template_find_field(t_template *x, t_symbol *name, int *p_onset,
141 int *p_type, t_symbol **p_arraytype) 150 int *p_type, t_symbol **p_arraytype)
142{ 151{
152#ifndef ROCKBOX
143 t_template *t; 153 t_template *t;
154#endif
144 int i, n; 155 int i, n;
145 if (!x) 156 if (!x)
146 { 157 {
@@ -262,7 +273,13 @@ elements might still be old ones.
262static void template_conformwords(t_template *tfrom, t_template *tto, 273static void template_conformwords(t_template *tfrom, t_template *tto,
263 int *conformaction, t_word *wfrom, t_word *wto) 274 int *conformaction, t_word *wfrom, t_word *wto)
264{ 275{
276#ifdef ROCKBOX
277 int nto = tto->t_n, i;
278
279 (void) tfrom;
280#else
265 int nfrom = tfrom->t_n, nto = tto->t_n, i; 281 int nfrom = tfrom->t_n, nto = tto->t_n, i;
282#endif
266 for (i = 0; i < nto; i++) 283 for (i = 0; i < nto; i++)
267 { 284 {
268 if (conformaction[i] >= 0) 285 if (conformaction[i] >= 0)
@@ -282,7 +299,11 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
282{ 299{
283 t_scalar *x; 300 t_scalar *x;
284 t_gpointer gp; 301 t_gpointer gp;
302#ifdef ROCKBOX
303 int i;
304#else
285 int nto = tto->t_n, nfrom = tfrom->t_n, i; 305 int nto = tto->t_n, nfrom = tfrom->t_n, i;
306#endif
286 t_template *scalartemplate; 307 t_template *scalartemplate;
287 /* post("conform scalar"); */ 308 /* post("conform scalar"); */
288 /* possibly replace the scalar */ 309 /* possibly replace the scalar */
@@ -311,7 +332,7 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
311 else 332 else
312 { 333 {
313 t_gobj *y, *y2; 334 t_gobj *y, *y2;
314 for (y = glist->gl_list; y2 = y->g_next; y = y2) 335 for (y = glist->gl_list; (y2 = y->g_next); y = y2)
315 if (y2 == &scfrom->sc_gobj) 336 if (y2 == &scfrom->sc_gobj)
316 { 337 {
317 x->sc_gobj.g_next = y2->g_next; 338 x->sc_gobj.g_next = y2->g_next;
@@ -447,7 +468,9 @@ void template_conform(t_template *tfrom, t_template *tto)
447 468
448t_template *template_findbyname(t_symbol *s) 469t_template *template_findbyname(t_symbol *s)
449{ 470{
471#ifndef ROCKBOX
450 int i; 472 int i;
473#endif
451 if (s == &s_float) 474 if (s == &s_float)
452 return (&template_float); 475 return (&template_float);
453 else return ((t_template *)pd_findbyclass(s, template_class)); 476 else return ((t_template *)pd_findbyclass(s, template_class));
@@ -477,6 +500,10 @@ static void *template_usetemplate(void *dummy, t_symbol *s,
477 t_template *x; 500 t_template *x;
478 t_symbol *templatesym = 501 t_symbol *templatesym =
479 canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); 502 canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
503#ifdef ROCKBOX
504 (void) dummy;
505 (void) s;
506#endif
480 if (!argc) 507 if (!argc)
481 return (0); 508 return (0);
482 argc--; argv++; 509 argc--; argv++;
@@ -540,7 +567,9 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv)
540 t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class); 567 t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
541 t_template *t = template_findbyname(sym); 568 t_template *t = template_findbyname(sym);
542 int i; 569 int i;
570#ifndef ROCKBOX
543 t_symbol *sx = gensym("x"); 571 t_symbol *sx = gensym("x");
572#endif
544 x->x_owner = canvas_getcurrent(); 573 x->x_owner = canvas_getcurrent();
545 x->x_next = 0; 574 x->x_next = 0;
546 x->x_sym = sym; 575 x->x_sym = sym;
@@ -559,7 +588,7 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv)
559 if (t->t_list) 588 if (t->t_list)
560 { 589 {
561 t_gtemplate *x2, *x3; 590 t_gtemplate *x2, *x3;
562 for (x2 = x->x_template->t_list; x3 = x2->x_next; x2 = x3) 591 for(x2 = x->x_template->t_list; (x3 = x2->x_next); x2 = x3)
563 ; 592 ;
564 x2->x_next = x; 593 x2->x_next = x;
565 post("template %s: warning: already exists.", sym->s_name); 594 post("template %s: warning: already exists.", sym->s_name);
@@ -593,8 +622,13 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv)
593 622
594static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv) 623static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv)
595{ 624{
625#ifndef ROCKBOX
596 t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class); 626 t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
627#endif
597 t_symbol *sym = atom_getsymbolarg(0, argc, argv); 628 t_symbol *sym = atom_getsymbolarg(0, argc, argv);
629#ifdef ROCKBOX
630 (void) s;
631#endif
598 if (argc >= 1) 632 if (argc >= 1)
599 argc--; argv++; 633 argc--; argv++;
600 return (gtemplate_donew(canvas_makebindsym(sym), argc, argv)); 634 return (gtemplate_donew(canvas_makebindsym(sym), argc, argv));
@@ -603,9 +637,14 @@ static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv)
603 /* old version (0.34) -- delete 2003 or so */ 637 /* old version (0.34) -- delete 2003 or so */
604static void *gtemplate_new_old(t_symbol *s, int argc, t_atom *argv) 638static void *gtemplate_new_old(t_symbol *s, int argc, t_atom *argv)
605{ 639{
640#ifndef ROCKBOX
606 t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class); 641 t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
642#endif
607 t_symbol *sym = canvas_makebindsym(canvas_getcurrent()->gl_name); 643 t_symbol *sym = canvas_makebindsym(canvas_getcurrent()->gl_name);
608 static int warned; 644 static int warned;
645#ifdef ROCKBOX
646 (void) s;
647#endif
609 if (!warned) 648 if (!warned)
610 { 649 {
611 post("warning -- 'template' (%s) is obsolete; replace with 'struct'", 650 post("warning -- 'template' (%s) is obsolete; replace with 'struct'",
@@ -643,7 +682,7 @@ static void gtemplate_free(t_gtemplate *x)
643 else 682 else
644 { 683 {
645 t_gtemplate *x2, *x3; 684 t_gtemplate *x2, *x3;
646 for (x2 = t->t_list; x3 = x2->x_next; x2 = x3) 685 for(x2 = t->t_list; (x3 = x2->x_next); x2 = x3)
647 { 686 {
648 if (x == x3) 687 if (x == x3)
649 { 688 {
@@ -829,6 +868,16 @@ static void curve_displace(t_gobj *z, t_glist *glist,
829 t_word *data, t_template *template, float basex, float basey, 868 t_word *data, t_template *template, float basex, float basey,
830 int dx, int dy) 869 int dx, int dy)
831{ 870{
871#ifdef ROCKBOX
872 (void) z;
873 (void) glist;
874 (void) data;
875 (void) template;
876 (void) basex;
877 (void) basey;
878 (void) dx;
879 (void) dy;
880#endif
832 /* refuse */ 881 /* refuse */
833} 882}
834 883
@@ -836,6 +885,15 @@ static void curve_select(t_gobj *z, t_glist *glist,
836 t_word *data, t_template *template, float basex, float basey, 885 t_word *data, t_template *template, float basex, float basey,
837 int state) 886 int state)
838{ 887{
888#ifdef ROCKBOX
889 (void) z;
890 (void) glist;
891 (void) data;
892 (void) template;
893 (void) basex;
894 (void) basey;
895 (void) state;
896#endif
839 /* fill in later */ 897 /* fill in later */
840} 898}
841 899
@@ -843,6 +901,15 @@ static void curve_activate(t_gobj *z, t_glist *glist,
843 t_word *data, t_template *template, float basex, float basey, 901 t_word *data, t_template *template, float basex, float basey,
844 int state) 902 int state)
845{ 903{
904#ifdef ROCKBOX
905 (void) z;
906 (void) glist;
907 (void) data;
908 (void) template;
909 (void) basex;
910 (void) basey;
911 (void) state;
912#endif
846 /* fill in later */ 913 /* fill in later */
847} 914}
848 915
@@ -861,8 +928,13 @@ static void numbertocolor(int n, char *s)
861 red = n / 100; 928 red = n / 100;
862 blue = ((n / 10) % 10); 929 blue = ((n / 10) % 10);
863 green = n % 10; 930 green = n % 10;
931#ifdef ROCKBOX
932 snprintf(s, 8, "#%2.2x%2.2x%2.2x",
933 rangecolor(red), rangecolor(blue), rangecolor(green));
934#else
864 sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(red), rangecolor(blue), 935 sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(red), rangecolor(blue),
865 rangecolor(green)); 936 rangecolor(green));
937#endif
866} 938}
867 939
868static void curve_vis(t_gobj *z, t_glist *glist, 940static void curve_vis(t_gobj *z, t_glist *glist,
@@ -872,12 +944,22 @@ static void curve_vis(t_gobj *z, t_glist *glist,
872 t_curve *x = (t_curve *)z; 944 t_curve *x = (t_curve *)z;
873 int i, n = x->x_npoints; 945 int i, n = x->x_npoints;
874 t_fielddesc *f = x->x_vec; 946 t_fielddesc *f = x->x_vec;
947
948#ifdef ROCKBOX
949 (void) glist;
950 (void) basex;
951 (void) basey;
952#endif
875 953
876 if (vis) 954 if (vis)
877 { 955 {
878 if (n > 1) 956 if (n > 1)
879 { 957 {
958#ifdef ROCKBOX
959 int flags = x->x_flags;
960#else
880 int flags = x->x_flags, closed = (flags & CLOSED); 961 int flags = x->x_flags, closed = (flags & CLOSED);
962#endif
881 float width = fielddesc_getfloat(&x->x_width, template, data, 1); 963 float width = fielddesc_getfloat(&x->x_width, template, data, 1);
882 char outline[20], fill[20]; 964 char outline[20], fill[20];
883 if (width < 1) width = 1; 965 if (width < 1) width = 1;
@@ -889,19 +971,26 @@ static void curve_vis(t_gobj *z, t_glist *glist,
889 numbertocolor( 971 numbertocolor(
890 fielddesc_getfloat(&x->x_fillcolor, template, data, 1), 972 fielddesc_getfloat(&x->x_fillcolor, template, data, 1),
891 fill); 973 fill);
974#ifndef ROCKBOX
892 sys_vgui(".x%x.c create polygon\\\n", 975 sys_vgui(".x%x.c create polygon\\\n",
893 glist_getcanvas(glist)); 976 glist_getcanvas(glist));
977#endif
894 } 978 }
979#ifndef ROCKBOX
895 else sys_vgui(".x%x.c create line\\\n", 980 else sys_vgui(".x%x.c create line\\\n",
896 glist_getcanvas(glist)); 981 glist_getcanvas(glist));
982#endif
897 for (i = 0, f = x->x_vec; i < n; i++, f += 2) 983 for (i = 0, f = x->x_vec; i < n; i++, f += 2)
898 { 984 {
985#ifndef ROCKBOX
899 float xloc = glist_xtopixels(glist, 986 float xloc = glist_xtopixels(glist,
900 basex + fielddesc_getfloat(f, template, data, 1)); 987 basex + fielddesc_getfloat(f, template, data, 1));
901 float yloc = glist_ytopixels(glist, 988 float yloc = glist_ytopixels(glist,
902 basey + fielddesc_getfloat(f+1, template, data, 1)); 989 basey + fielddesc_getfloat(f+1, template, data, 1));
903 sys_vgui("%d %d\\\n", (int)xloc, (int)yloc); 990 sys_vgui("%d %d\\\n", (int)xloc, (int)yloc);
991#endif
904 } 992 }
993#ifndef ROCKBOX
905 sys_vgui("-width %f\\\n", 994 sys_vgui("-width %f\\\n",
906 fielddesc_getfloat(&x->x_width, template, data, 1)); 995 fielddesc_getfloat(&x->x_width, template, data, 1));
907 if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n", 996 if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n",
@@ -909,13 +998,16 @@ static void curve_vis(t_gobj *z, t_glist *glist,
909 else sys_vgui("-fill %s\\\n", outline); 998 else sys_vgui("-fill %s\\\n", outline);
910 if (flags & BEZ) sys_vgui("-smooth 1\\\n"); 999 if (flags & BEZ) sys_vgui("-smooth 1\\\n");
911 sys_vgui("-tags curve%x\n", data); 1000 sys_vgui("-tags curve%x\n", data);
1001#endif
912 } 1002 }
913 else post("warning: curves need at least two points to be graphed"); 1003 else post("warning: curves need at least two points to be graphed");
914 } 1004 }
915 else 1005 else
916 { 1006 {
1007#ifndef ROCKBOX
917 if (n > 1) sys_vgui(".x%x.c delete curve%x\n", 1008 if (n > 1) sys_vgui(".x%x.c delete curve%x\n",
918 glist_getcanvas(glist), data); 1009 glist_getcanvas(glist), data);
1010#endif
919 } 1011 }
920} 1012}
921 1013
@@ -969,6 +1061,13 @@ static int curve_click(t_gobj *z, t_glist *glist,
969 int besterror = 0x7fffffff; 1061 int besterror = 0x7fffffff;
970 t_fielddesc *f = x->x_vec; 1062 t_fielddesc *f = x->x_vec;
971 t_word *data = sc->sc_vec; 1063 t_word *data = sc->sc_vec;
1064
1065#ifdef ROCKBOX
1066 (void) shift;
1067 (void) alt;
1068 (void) dbl;
1069#endif
1070
972 for (i = 0, f = x->x_vec; i < n; i++, f += 2) 1071 for (i = 0, f = x->x_vec; i < n; i++, f += 2)
973 { 1072 {
974 int xloc = glist_xtopixels(glist, 1073 int xloc = glist_xtopixels(glist,
@@ -1060,9 +1159,16 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
1060{ 1159{
1061 t_plot *x = (t_plot *)pd_new(plot_class); 1160 t_plot *x = (t_plot *)pd_new(plot_class);
1062 int flags = 0; 1161 int flags = 0;
1162#ifndef ROCKBOX
1063 int nxy, i; 1163 int nxy, i;
1064 t_fielddesc *fd; 1164 t_fielddesc *fd;
1165#endif
1065 t_symbol *firstarg = atom_getsymbolarg(0, argc, argv); 1166 t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
1167
1168#ifdef ROCKBOX
1169 (void) classsym;
1170#endif
1171
1066 if (!strcmp(firstarg->s_name, "curve")) 1172 if (!strcmp(firstarg->s_name, "curve"))
1067 { 1173 {
1068 flags |= BEZ; 1174 flags |= BEZ;
@@ -1132,7 +1238,11 @@ int array_getfields(t_symbol *elemtemplatesym,
1132 t_template **elemtemplatep, int *elemsizep, 1238 t_template **elemtemplatep, int *elemsizep,
1133 int *xonsetp, int *yonsetp, int *wonsetp) 1239 int *xonsetp, int *yonsetp, int *wonsetp)
1134{ 1240{
1241#ifdef ROCKBOX
1242 int elemsize, yonset, wonset, xonset, type;
1243#else
1135 int arrayonset, elemsize, yonset, wonset, xonset, type; 1244 int arrayonset, elemsize, yonset, wonset, xonset, type;
1245#endif
1136 t_template *elemtemplate; 1246 t_template *elemtemplate;
1137 t_symbol *dummy; 1247 t_symbol *dummy;
1138 t_canvas *elemtemplatecanvas = 0; 1248 t_canvas *elemtemplatecanvas = 0;
@@ -1219,6 +1329,16 @@ static void plot_displace(t_gobj *z, t_glist *glist,
1219 t_word *data, t_template *template, float basex, float basey, 1329 t_word *data, t_template *template, float basex, float basey,
1220 int dx, int dy) 1330 int dx, int dy)
1221{ 1331{
1332#ifdef ROCKBOX
1333 (void) z;
1334 (void) glist;
1335 (void) data;
1336 (void) template;
1337 (void) basex;
1338 (void) basey;
1339 (void) dx;
1340 (void) dy;
1341#endif
1222 /* not yet */ 1342 /* not yet */
1223} 1343}
1224 1344
@@ -1226,6 +1346,15 @@ static void plot_select(t_gobj *z, t_glist *glist,
1226 t_word *data, t_template *template, float basex, float basey, 1346 t_word *data, t_template *template, float basex, float basey,
1227 int state) 1347 int state)
1228{ 1348{
1349#ifdef ROCKBOX
1350 (void) z;
1351 (void) glist;
1352 (void) data;
1353 (void) template;
1354 (void) basex;
1355 (void) basey;
1356 (void) state;
1357#endif
1229 /* not yet */ 1358 /* not yet */
1230} 1359}
1231 1360
@@ -1233,6 +1362,15 @@ static void plot_activate(t_gobj *z, t_glist *glist,
1233 t_word *data, t_template *template, float basex, float basey, 1362 t_word *data, t_template *template, float basex, float basey,
1234 int state) 1363 int state)
1235{ 1364{
1365#ifdef ROCKBOX
1366 (void) z;
1367 (void) glist;
1368 (void) data;
1369 (void) template;
1370 (void) basex;
1371 (void) basey;
1372 (void) state;
1373#endif
1236 /* not yet */ 1374 /* not yet */
1237} 1375}
1238 1376
@@ -1270,8 +1408,10 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1270 { 1408 {
1271 /* found "w" field which controls linewidth. The trace is 1409 /* found "w" field which controls linewidth. The trace is
1272 a filled polygon with 2n points. */ 1410 a filled polygon with 2n points. */
1411#ifndef ROCKBOX
1273 sys_vgui(".x%x.c create polygon \\\n", 1412 sys_vgui(".x%x.c create polygon \\\n",
1274 glist_getcanvas(glist)); 1413 glist_getcanvas(glist));
1414#endif
1275 1415
1276 for (i = 0, xsum = xloc; i < nelem; i++) 1416 for (i = 0, xsum = xloc; i < nelem; i++)
1277 { 1417 {
@@ -1287,9 +1427,11 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1287 ixpix = xpix + 0.5; 1427 ixpix = xpix + 0.5;
1288 if (xonset >= 0 || ixpix != lastpixel) 1428 if (xonset >= 0 || ixpix != lastpixel)
1289 { 1429 {
1430#ifndef ROCKBOX
1290 sys_vgui("%d %f \\\n", ixpix, 1431 sys_vgui("%d %f \\\n", ixpix,
1291 glist_ytopixels(glist, 1432 glist_ytopixels(glist,
1292 basey + yloc + yval - wval)); 1433 basey + yloc + yval - wval));
1434#endif
1293 ndrawn++; 1435 ndrawn++;
1294 } 1436 }
1295 lastpixel = ixpix; 1437 lastpixel = ixpix;
@@ -1310,8 +1452,10 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1310 ixpix = xpix + 0.5; 1452 ixpix = xpix + 0.5;
1311 if (xonset >= 0 || ixpix != lastpixel) 1453 if (xonset >= 0 || ixpix != lastpixel)
1312 { 1454 {
1455#ifndef ROCKBOX
1313 sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist, 1456 sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist,
1314 basey + yloc + yval + wval)); 1457 basey + yloc + yval + wval));
1458#endif
1315 ndrawn++; 1459 ndrawn++;
1316 } 1460 }
1317 lastpixel = ixpix; 1461 lastpixel = ixpix;
@@ -1321,23 +1465,31 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1321 should be at least two already. */ 1465 should be at least two already. */
1322 if (ndrawn < 4) 1466 if (ndrawn < 4)
1323 { 1467 {
1468#ifndef ROCKBOX
1324 sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist, 1469 sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist,
1325 basey + yloc + yval + wval)); 1470 basey + yloc + yval + wval));
1326 sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist, 1471 sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist,
1327 basey + yloc + yval - wval)); 1472 basey + yloc + yval - wval));
1473#endif
1328 } 1474 }
1329 ouch: 1475 ouch:
1476#ifdef ROCKBOX
1477 ;
1478#else /* ROCKBOX */
1330 sys_vgui(" -width 1 -fill %s -outline %s\\\n", outline, outline); 1479 sys_vgui(" -width 1 -fill %s -outline %s\\\n", outline, outline);
1331 if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n"); 1480 if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n");
1332 1481
1333 sys_vgui("-tags plot%x\n", data); 1482 sys_vgui("-tags plot%x\n", data);
1483#endif /* ROCKBOX */
1334 } 1484 }
1335 else if (linewidth > 0) 1485 else if (linewidth > 0)
1336 { 1486 {
1337 /* no "w" field. If the linewidth is positive, draw a 1487 /* no "w" field. If the linewidth is positive, draw a
1338 segmented line with the requested width; otherwise don't 1488 segmented line with the requested width; otherwise don't
1339 draw the trace at all. */ 1489 draw the trace at all. */
1490#ifndef ROCKBOX
1340 sys_vgui(".x%x.c create line \\\n", glist_getcanvas(glist)); 1491 sys_vgui(".x%x.c create line \\\n", glist_getcanvas(glist));
1492#endif
1341 1493
1342 for (xsum = xloc, i = 0; i < nelem; i++) 1494 for (xsum = xloc, i = 0; i < nelem; i++)
1343 { 1495 {
@@ -1352,14 +1504,17 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1352 ixpix = xpix + 0.5; 1504 ixpix = xpix + 0.5;
1353 if (xonset >= 0 || ixpix != lastpixel) 1505 if (xonset >= 0 || ixpix != lastpixel)
1354 { 1506 {
1507#ifndef ROCKBOX
1355 sys_vgui("%d %f \\\n", ixpix, 1508 sys_vgui("%d %f \\\n", ixpix,
1356 glist_ytopixels(glist, basey + yloc + yval)); 1509 glist_ytopixels(glist, basey + yloc + yval));
1510#endif
1357 ndrawn++; 1511 ndrawn++;
1358 } 1512 }
1359 lastpixel = ixpix; 1513 lastpixel = ixpix;
1360 if (ndrawn >= 1000) break; 1514 if (ndrawn >= 1000) break;
1361 } 1515 }
1362 /* TK will complain if there aren't at least 2 points... */ 1516 /* TK will complain if there aren't at least 2 points... */
1517#ifndef ROCKBOX
1363 if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n"); 1518 if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n");
1364 else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix + 10, 1519 else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix + 10,
1365 glist_ytopixels(glist, basey + yloc + yval)); 1520 glist_ytopixels(glist, basey + yloc + yval));
@@ -1369,6 +1524,7 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1369 if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n"); 1524 if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n");
1370 1525
1371 sys_vgui("-tags plot%x\n", data); 1526 sys_vgui("-tags plot%x\n", data);
1527#endif
1372 } 1528 }
1373 /* We're done with the outline; now draw all the points. 1529 /* We're done with the outline; now draw all the points.
1374 This code is inefficient since the template has to be 1530 This code is inefficient since the template has to be
@@ -1413,8 +1569,10 @@ static void plot_vis(t_gobj *z, t_glist *glist,
1413 } 1569 }
1414 } 1570 }
1415 /* and then the trace */ 1571 /* and then the trace */
1572#ifndef ROCKBOX
1416 sys_vgui(".x%x.c delete plot%x\n", 1573 sys_vgui(".x%x.c delete plot%x\n",
1417 glist_getcanvas(glist), data); 1574 glist_getcanvas(glist), data);
1575#endif
1418 } 1576 }
1419} 1577}
1420 1578
@@ -1526,8 +1684,12 @@ static void drawnumber_getrect(t_gobj *z, t_glist *glist,
1526 basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); 1684 basex + fielddesc_getfloat(&x->x_xloc, template, data, 0));
1527 int yloc = glist_ytopixels(glist, 1685 int yloc = glist_ytopixels(glist,
1528 basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); 1686 basey + fielddesc_getfloat(&x->x_yloc, template, data, 0));
1687#ifdef ROCKBOX
1688 int fontwidth = 8, fontheight = 10;
1689#else
1529 int font = glist_getfont(glist); 1690 int font = glist_getfont(glist);
1530 int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); 1691 int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
1692#endif
1531 char buf[DRAWNUMBER_BUFSIZE]; 1693 char buf[DRAWNUMBER_BUFSIZE];
1532 if (x->x_flags & DRAW_SYMBOL) 1694 if (x->x_flags & DRAW_SYMBOL)
1533 SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0)); 1695 SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0));
@@ -1543,6 +1705,16 @@ static void drawnumber_displace(t_gobj *z, t_glist *glist,
1543 t_word *data, t_template *template, float basex, float basey, 1705 t_word *data, t_template *template, float basex, float basey,
1544 int dx, int dy) 1706 int dx, int dy)
1545{ 1707{
1708#ifdef ROCKBOX
1709 (void) z;
1710 (void) glist;
1711 (void) data;
1712 (void) template;
1713 (void) basex;
1714 (void) basey;
1715 (void) dx;
1716 (void) dy;
1717#endif
1546 /* refuse */ 1718 /* refuse */
1547} 1719}
1548 1720
@@ -1550,6 +1722,14 @@ static void drawnumber_select(t_gobj *z, t_glist *glist,
1550 t_word *data, t_template *template, float basex, float basey, 1722 t_word *data, t_template *template, float basex, float basey,
1551 int state) 1723 int state)
1552{ 1724{
1725#ifdef ROCKBOX
1726 (void) z;
1727 (void) glist;
1728 (void) data;
1729 (void) template;
1730 (void) basex;
1731 (void) basey;
1732#endif
1553 post("drawnumber_select %d", state); 1733 post("drawnumber_select %d", state);
1554 /* fill in later */ 1734 /* fill in later */
1555} 1735}
@@ -1558,6 +1738,14 @@ static void drawnumber_activate(t_gobj *z, t_glist *glist,
1558 t_word *data, t_template *template, float basex, float basey, 1738 t_word *data, t_template *template, float basex, float basey,
1559 int state) 1739 int state)
1560{ 1740{
1741#ifdef ROCKBOX
1742 (void) z;
1743 (void) glist;
1744 (void) data;
1745 (void) template;
1746 (void) basex;
1747 (void) basey;
1748#endif
1561 post("drawnumber_activate %d", state); 1749 post("drawnumber_activate %d", state);
1562} 1750}
1563 1751
@@ -1566,14 +1754,22 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
1566 int vis) 1754 int vis)
1567{ 1755{
1568 t_drawnumber *x = (t_drawnumber *)z; 1756 t_drawnumber *x = (t_drawnumber *)z;
1569 1757
1758#ifdef ROCKBOX
1759 (void) glist;
1760 (void) basex;
1761 (void) basey;
1762#endif
1763
1570 if (vis) 1764 if (vis)
1571 { 1765 {
1572 t_atom at; 1766 t_atom at;
1767#ifndef ROCKBOX
1573 int xloc = glist_xtopixels(glist, 1768 int xloc = glist_xtopixels(glist,
1574 basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); 1769 basex + fielddesc_getfloat(&x->x_xloc, template, data, 0));
1575 int yloc = glist_ytopixels(glist, 1770 int yloc = glist_ytopixels(glist,
1576 basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); 1771 basey + fielddesc_getfloat(&x->x_yloc, template, data, 0));
1772#endif
1577 char colorstring[20], buf[DRAWNUMBER_BUFSIZE]; 1773 char colorstring[20], buf[DRAWNUMBER_BUFSIZE];
1578 numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1), 1774 numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1),
1579 colorstring); 1775 colorstring);
@@ -1581,13 +1777,17 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
1581 SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0)); 1777 SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0));
1582 else SETFLOAT(&at, fielddesc_getfloat(&x->x_value, template, data, 0)); 1778 else SETFLOAT(&at, fielddesc_getfloat(&x->x_value, template, data, 0));
1583 drawnumber_sprintf(x, buf, &at); 1779 drawnumber_sprintf(x, buf, &at);
1780#ifndef ROCKBOX
1584 sys_vgui(".x%x.c create text %d %d -anchor nw -fill %s -text {%s}", 1781 sys_vgui(".x%x.c create text %d %d -anchor nw -fill %s -text {%s}",
1585 glist_getcanvas(glist), xloc, yloc, colorstring, buf); 1782 glist_getcanvas(glist), xloc, yloc, colorstring, buf);
1586 sys_vgui(" -font -*-courier-bold--normal--%d-*", 1783 sys_vgui(" -font -*-courier-bold--normal--%d-*",
1587 sys_hostfontsize(glist_getfont(glist))); 1784 sys_hostfontsize(glist_getfont(glist)));
1588 sys_vgui(" -tags drawnumber%x\n", data); 1785 sys_vgui(" -tags drawnumber%x\n", data);
1786#endif
1589 } 1787 }
1788#ifndef ROCKBOX
1590 else sys_vgui(".x%x.c delete drawnumber%x\n", glist_getcanvas(glist), data); 1789 else sys_vgui(".x%x.c delete drawnumber%x\n", glist_getcanvas(glist), data);
1790#endif
1591} 1791}
1592 1792
1593static float drawnumber_motion_ycumulative; 1793static float drawnumber_motion_ycumulative;
@@ -1604,6 +1804,9 @@ static void drawnumber_motion(void *z, t_floatarg dx, t_floatarg dy)
1604 t_drawnumber *x = (t_drawnumber *)z; 1804 t_drawnumber *x = (t_drawnumber *)z;
1605 t_fielddesc *f = &x->x_value; 1805 t_fielddesc *f = &x->x_value;
1606 drawnumber_motion_ycumulative -= dy; 1806 drawnumber_motion_ycumulative -= dy;
1807#ifdef ROCKBOX
1808 (void) dx;
1809#endif
1607 template_setfloat(drawnumber_motion_template, 1810 template_setfloat(drawnumber_motion_template,
1608 f->fd_un.fd_varsym, 1811 f->fd_un.fd_varsym,
1609 drawnumber_motion_wp, 1812 drawnumber_motion_wp,
@@ -1619,6 +1822,11 @@ static int drawnumber_click(t_gobj *z, t_glist *glist,
1619 t_drawnumber *x = (t_drawnumber *)z; 1822 t_drawnumber *x = (t_drawnumber *)z;
1620 int x1, y1, x2, y2; 1823 int x1, y1, x2, y2;
1621 t_word *data = sc->sc_vec; 1824 t_word *data = sc->sc_vec;
1825#ifdef ROCKBOX
1826 (void) shift;
1827 (void) alt;
1828 (void) dbl;
1829#endif
1622 drawnumber_getrect(z, glist, 1830 drawnumber_getrect(z, glist,
1623 sc->sc_vec, template, basex, basey, 1831 sc->sc_vec, template, basex, basey,
1624 &x1, &y1, &x2, &y2); 1832 &x1, &y1, &x2, &y2);
@@ -1652,6 +1860,9 @@ t_parentwidgetbehavior drawnumber_widgetbehavior =
1652 1860
1653static void drawnumber_free(t_drawnumber *x) 1861static void drawnumber_free(t_drawnumber *x)
1654{ 1862{
1863#ifdef ROCKBOX
1864 (void) x;
1865#endif
1655} 1866}
1656 1867
1657static void drawnumber_setup(void) 1868static void drawnumber_setup(void)
@@ -1678,3 +1889,4 @@ void g_template_setup(void)
1678} 1889}
1679 1890
1680 1891
1892