summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/g_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_text.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/g_text.c201
1 files changed, 198 insertions, 3 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_text.c b/apps/plugins/pdbox/PDa/src/g_text.c
index f1fbb7f719..98b3fb74f8 100644
--- a/apps/plugins/pdbox/PDa/src/g_text.c
+++ b/apps/plugins/pdbox/PDa/src/g_text.c
@@ -6,15 +6,21 @@
6/* the methods for calling the gui-objects from menu are implemented */ 6/* the methods for calling the gui-objects from menu are implemented */
7/* all changes are labeled with iemlib */ 7/* all changes are labeled with iemlib */
8 8
9#include <stdlib.h>
10#include "m_pd.h" 9#include "m_pd.h"
11#include "m_imp.h" 10#include "m_imp.h"
12#include "s_stuff.h" 11#include "s_stuff.h"
13#include "t_tk.h" 12#include "t_tk.h"
14#include "g_canvas.h" 13#include "g_canvas.h"
14
15#ifdef ROCKBOX
16#include "plugin.h"
17#include "pdbox.h"
18#else /* ROCKBOX */
19#include <stdlib.h>
15#include <stdio.h> 20#include <stdio.h>
16#include <string.h> 21#include <string.h>
17#include <math.h> 22#include <math.h>
23#endif /* ROCKBOX */
18 24
19static t_class *text_class; 25static t_class *text_class;
20static t_class *message_class; 26static t_class *message_class;
@@ -39,6 +45,11 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
39{ 45{
40 t_text *x = (t_text *)pd_new(text_class); 46 t_text *x = (t_text *)pd_new(text_class);
41 t_atom at; 47 t_atom at;
48
49#ifdef ROCKBOX
50 (void) s;
51#endif
52
42 x->te_width = 0; /* don't know it yet. */ 53 x->te_width = 0; /* don't know it yet. */
43 x->te_type = T_TEXT; 54 x->te_type = T_TEXT;
44 x->te_binbuf = binbuf_new(); 55 x->te_binbuf = binbuf_new();
@@ -138,7 +149,12 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected,
138 149
139void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 150void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
140{ 151{
152#ifdef ROCKBOX
153 (void) s;
154#else
141 t_text *x; 155 t_text *x;
156#endif
157
142 if (argc >= 2) 158 if (argc >= 2)
143 { 159 {
144 t_binbuf *b = binbuf_new(); 160 t_binbuf *b = binbuf_new();
@@ -178,56 +194,111 @@ void canvas_iemguis(t_glist *gl, t_symbol *guiobjname)
178 194
179void canvas_bng(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 195void canvas_bng(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
180{ 196{
197#ifdef ROCKBOX
198 (void) s;
199 (void) argc;
200 (void) argv;
201#endif
181 canvas_iemguis(gl, gensym("bng")); 202 canvas_iemguis(gl, gensym("bng"));
182} 203}
183 204
184void canvas_toggle(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 205void canvas_toggle(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
185{ 206{
207#ifdef ROCKBOX
208 (void) s;
209 (void) argc;
210 (void) argv;
211#endif
186 canvas_iemguis(gl, gensym("tgl")); 212 canvas_iemguis(gl, gensym("tgl"));
187} 213}
188 214
189void canvas_vslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 215void canvas_vslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
190{ 216{
217#ifdef ROCKBOX
218 (void) s;
219 (void) argc;
220 (void) argv;
221#endif
191 canvas_iemguis(gl, gensym("vsl")); 222 canvas_iemguis(gl, gensym("vsl"));
192} 223}
193 224
194void canvas_hslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 225void canvas_hslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
195{ 226{
227#ifdef ROCKBOX
228 (void) s;
229 (void) argc;
230 (void) argv;
231#endif
196 canvas_iemguis(gl, gensym("hsl")); 232 canvas_iemguis(gl, gensym("hsl"));
197} 233}
198 234
199void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 235void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
200{ 236{
237#ifdef ROCKBOX
238 (void) s;
239 (void) argc;
240 (void) argv;
241#endif
201 canvas_iemguis(gl, gensym("hdl")); 242 canvas_iemguis(gl, gensym("hdl"));
202} 243}
203 244
204void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 245void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
205{ 246{
247#ifdef ROCKBOX
248 (void) s;
249 (void) argc;
250 (void) argv;
251#endif
206 canvas_iemguis(gl, gensym("vdl")); 252 canvas_iemguis(gl, gensym("vdl"));
207} 253}
208 254
209void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 255void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
210{ 256{
257#ifdef ROCKBOX
258 (void) s;
259 (void) argc;
260 (void) argv;
261#endif
211 canvas_iemguis(gl, gensym("hradio")); 262 canvas_iemguis(gl, gensym("hradio"));
212} 263}
213 264
214void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 265void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
215{ 266{
267#ifdef ROCKBOX
268 (void) s;
269 (void) argc;
270 (void) argv;
271#endif
216 canvas_iemguis(gl, gensym("vradio")); 272 canvas_iemguis(gl, gensym("vradio"));
217} 273}
218 274
219void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 275void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
220{ 276{
277#ifdef ROCKBOX
278 (void) s;
279 (void) argc;
280 (void) argv;
281#endif
221 canvas_iemguis(gl, gensym("vu")); 282 canvas_iemguis(gl, gensym("vu"));
222} 283}
223 284
224void canvas_mycnv(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 285void canvas_mycnv(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
225{ 286{
287#ifdef ROCKBOX
288 (void) s;
289 (void) argc;
290 (void) argv;
291#endif
226 canvas_iemguis(gl, gensym("cnv")); 292 canvas_iemguis(gl, gensym("cnv"));
227} 293}
228 294
229void canvas_numbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 295void canvas_numbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
230{ 296{
297#ifdef ROCKBOX
298 (void) s;
299 (void) argc;
300 (void) argv;
301#endif
231 canvas_iemguis(gl, gensym("nbx")); 302 canvas_iemguis(gl, gensym("nbx"));
232} 303}
233 304
@@ -310,11 +381,17 @@ static void message_symbol(t_message *x, t_symbol *s)
310 381
311static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv) 382static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
312{ 383{
384#ifdef ROCKBOX
385 (void) s;
386#endif
313 binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, argc, argv); 387 binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, argc, argv);
314} 388}
315 389
316static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv) 390static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
317{ 391{
392#ifdef ROCKBOX
393 (void) s;
394#endif
318 binbuf_clear(x->m_text.te_binbuf); 395 binbuf_clear(x->m_text.te_binbuf);
319 binbuf_add(x->m_text.te_binbuf, argc, argv); 396 binbuf_add(x->m_text.te_binbuf, argc, argv);
320 glist_retext(x->m_glist, &x->m_text); 397 glist_retext(x->m_glist, &x->m_text);
@@ -322,12 +399,18 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
322 399
323static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv) 400static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
324{ 401{
402#ifdef ROCKBOX
403 (void) s;
404#endif
325 binbuf_add(x->m_text.te_binbuf, argc, argv); 405 binbuf_add(x->m_text.te_binbuf, argc, argv);
326 glist_retext(x->m_glist, &x->m_text); 406 glist_retext(x->m_glist, &x->m_text);
327} 407}
328 408
329static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv) 409static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
330{ 410{
411#ifdef ROCKBOX
412 (void) s;
413#endif
331 binbuf_add(x->m_text.te_binbuf, argc, argv); 414 binbuf_add(x->m_text.te_binbuf, argc, argv);
332 binbuf_addsemi(x->m_text.te_binbuf); 415 binbuf_addsemi(x->m_text.te_binbuf);
333 glist_retext(x->m_glist, &x->m_text); 416 glist_retext(x->m_glist, &x->m_text);
@@ -337,12 +420,21 @@ static void message_click(t_message *x,
337 t_floatarg xpos, t_floatarg ypos, t_floatarg shift, 420 t_floatarg xpos, t_floatarg ypos, t_floatarg shift,
338 t_floatarg ctrl, t_floatarg alt) 421 t_floatarg ctrl, t_floatarg alt)
339{ 422{
423#ifdef ROCKBOX
424 (void) xpos;
425 (void) ypos;
426 (void) shift;
427 (void) ctrl;
428 (void) alt;
429#endif
340 message_float(x, 0); 430 message_float(x, 0);
341 if (glist_isvisible(x->m_glist)) 431 if (glist_isvisible(x->m_glist))
342 { 432 {
433#ifndef ROCKBOX
343 t_rtext *y = glist_findrtext(x->m_glist, &x->m_text); 434 t_rtext *y = glist_findrtext(x->m_glist, &x->m_text);
344 sys_vgui(".x%x.c itemconfigure %sR -width 5\n", 435 sys_vgui(".x%x.c itemconfigure %sR -width 5\n",
345 glist_getcanvas(x->m_glist), rtext_gettag(y)); 436 glist_getcanvas(x->m_glist), rtext_gettag(y));
437#endif
346 clock_delay(x->m_clock, 120); 438 clock_delay(x->m_clock, 120);
347 } 439 }
348} 440}
@@ -351,9 +443,11 @@ static void message_tick(t_message *x)
351{ 443{
352 if (glist_isvisible(x->m_glist)) 444 if (glist_isvisible(x->m_glist))
353 { 445 {
446#ifndef ROCKBOX
354 t_rtext *y = glist_findrtext(x->m_glist, &x->m_text); 447 t_rtext *y = glist_findrtext(x->m_glist, &x->m_text);
355 sys_vgui(".x%x.c itemconfigure %sR -width 1\n", 448 sys_vgui(".x%x.c itemconfigure %sR -width 1\n",
356 glist_getcanvas(x->m_glist), rtext_gettag(y)); 449 glist_getcanvas(x->m_glist), rtext_gettag(y));
450#endif
357 } 451 }
358} 452}
359 453
@@ -364,6 +458,9 @@ static void message_free(t_message *x)
364 458
365void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) 459void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
366{ 460{
461#ifdef ROCKBOX
462 (void) s;
463#endif
367 t_message *x = (t_message *)pd_new(message_class); 464 t_message *x = (t_message *)pd_new(message_class);
368 x->m_messresponder.mr_pd = messresponder_class; 465 x->m_messresponder.mr_pd = messresponder_class;
369 x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float); 466 x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float);
@@ -467,6 +564,9 @@ static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
467{ 564{
468 t_atom oldatom = x->a_atom; 565 t_atom oldatom = x->a_atom;
469 int senditup = 0; 566 int senditup = 0;
567#ifdef ROCKBOX
568 (void) s;
569#endif
470 if (!argc) return; 570 if (!argc) return;
471 if (x->a_atom.a_type == A_FLOAT) 571 if (x->a_atom.a_type == A_FLOAT)
472 x->a_atom.a_w.w_float = atom_getfloat(argv), 572 x->a_atom.a_w.w_float = atom_getfloat(argv),
@@ -538,6 +638,9 @@ static void gatom_symbol(t_gatom *x, t_symbol *s)
538 638
539static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy) 639static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy)
540{ 640{
641#ifdef ROCKBOX
642 (void) dx;
643#endif
541 t_gatom *x = (t_gatom *)z; 644 t_gatom *x = (t_gatom *)z;
542 if (dy == 0) return; 645 if (dy == 0) return;
543 if (x->a_atom.a_type == A_FLOAT) 646 if (x->a_atom.a_type == A_FLOAT)
@@ -597,7 +700,7 @@ static void gatom_key(void *z, t_floatarg f)
597 { 700 {
598 /* for numbers, only let reasonable characters through */ 701 /* for numbers, only let reasonable characters through */
599 if ((x->a_atom.a_type == A_SYMBOL) || 702 if ((x->a_atom.a_type == A_SYMBOL) ||
600 (c >= '0' && c <= '9' || c == '.' || c == '-' 703 ((c >= '0' && c <= '9') || c == '.' || c == '-'
601 || c == 'e' || c == 'E')) 704 || c == 'e' || c == 'E'))
602 { 705 {
603 x->a_buf[len] = c; 706 x->a_buf[len] = c;
@@ -608,7 +711,11 @@ static void gatom_key(void *z, t_floatarg f)
608 return; 711 return;
609redraw: 712redraw:
610 /* LATER figure out how to avoid creating all these symbols! */ 713 /* LATER figure out how to avoid creating all these symbols! */
714#ifdef ROCKBOX
715 snprintf(sbuf, sizeof(sbuf)-1, "%s...", x->a_buf);
716#else /* ROCKBOX */
611 sprintf(sbuf, "%s...", x->a_buf); 717 sprintf(sbuf, "%s...", x->a_buf);
718#endif
612 SETSYMBOL(&at, gensym(sbuf)); 719 SETSYMBOL(&at, gensym(sbuf));
613 binbuf_clear(x->a_text.te_binbuf); 720 binbuf_clear(x->a_text.te_binbuf);
614 binbuf_add(x->a_text.te_binbuf, 1, &at); 721 binbuf_add(x->a_text.te_binbuf, 1, &at);
@@ -619,6 +726,9 @@ static void gatom_click(t_gatom *x,
619 t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, 726 t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl,
620 t_floatarg alt) 727 t_floatarg alt)
621{ 728{
729#ifdef ROCKBOX
730 (void) ctrl;
731#endif
622 if (x->a_text.te_width == 1) 732 if (x->a_text.te_width == 1)
623 { 733 {
624 if (x->a_atom.a_type == A_FLOAT) 734 if (x->a_atom.a_type == A_FLOAT)
@@ -655,6 +765,10 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv)
655 t_symbol *symfrom = gatom_unescapit(atom_getsymbolarg(5, argc, argv)); 765 t_symbol *symfrom = gatom_unescapit(atom_getsymbolarg(5, argc, argv));
656 t_symbol *symto = gatom_unescapit(atom_getsymbolarg(6, argc, argv)); 766 t_symbol *symto = gatom_unescapit(atom_getsymbolarg(6, argc, argv));
657 767
768#ifdef ROCKBOX
769 (void) sel;
770#endif
771
658 gobj_vis(&x->a_text.te_g, x->a_glist, 0); 772 gobj_vis(&x->a_text.te_g, x->a_glist, 0);
659 if (!*symfrom->s_name && *x->a_symfrom->s_name) 773 if (!*symfrom->s_name && *x->a_symfrom->s_name)
660 inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); 774 inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0);
@@ -708,7 +822,11 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
708 { 822 {
709 *xp = x1 - 3 - 823 *xp = x1 - 3 -
710 strlen(canvas_realizedollar(x->a_glist, x->a_label)->s_name) * 824 strlen(canvas_realizedollar(x->a_glist, x->a_label)->s_name) *
825#ifdef ROCKBOX
826 8;
827#else
711 sys_fontwidth(glist_getfont(glist)); 828 sys_fontwidth(glist_getfont(glist));
829#endif
712 *yp = y1 + 2; 830 *yp = y1 + 2;
713 } 831 }
714 else if (x->a_wherelabel == ATOM_LABELRIGHT) 832 else if (x->a_wherelabel == ATOM_LABELRIGHT)
@@ -719,7 +837,11 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
719 else if (x->a_wherelabel == ATOM_LABELUP) 837 else if (x->a_wherelabel == ATOM_LABELUP)
720 { 838 {
721 *xp = x1 - 1; 839 *xp = x1 - 1;
840#ifdef ROCKBOX
841 *yp = y1 - 1 - 10;
842#else
722 *yp = y1 - 1 - sys_fontheight(glist_getfont(glist));; 843 *yp = y1 - 1 - sys_fontheight(glist_getfont(glist));;
844#endif
723 } 845 }
724 else 846 else
725 { 847 {
@@ -731,10 +853,14 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp)
731static void gatom_displace(t_gobj *z, t_glist *glist, 853static void gatom_displace(t_gobj *z, t_glist *glist,
732 int dx, int dy) 854 int dx, int dy)
733{ 855{
856#ifndef ROCKBOX
734 t_gatom *x = (t_gatom*)z; 857 t_gatom *x = (t_gatom*)z;
858#endif
735 text_displace(z, glist, dx, dy); 859 text_displace(z, glist, dx, dy);
860#ifndef ROCKBOX
736 sys_vgui(".x%x.c move %x.l %d %d\n", glist_getcanvas(glist), 861 sys_vgui(".x%x.c move %x.l %d %d\n", glist_getcanvas(glist),
737 x, dx, dy); 862 x, dx, dy);
863#endif
738} 864}
739 865
740static void gatom_vis(t_gobj *z, t_glist *glist, int vis) 866static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
@@ -747,14 +873,18 @@ static void gatom_vis(t_gobj *z, t_glist *glist, int vis)
747 { 873 {
748 int x1, y1; 874 int x1, y1;
749 gatom_getwherelabel(x, glist, &x1, &y1); 875 gatom_getwherelabel(x, glist, &x1, &y1);
876#ifndef ROCKBOX
750 sys_vgui("pdtk_text_new .x%x.c %x.l %f %f {%s} %d %s\n", 877 sys_vgui("pdtk_text_new .x%x.c %x.l %f %f {%s} %d %s\n",
751 glist_getcanvas(glist), x, 878 glist_getcanvas(glist), x,
752 (double)x1, (double)y1, 879 (double)x1, (double)y1,
753 canvas_realizedollar(x->a_glist, x->a_label)->s_name, 880 canvas_realizedollar(x->a_glist, x->a_label)->s_name,
754 sys_hostfontsize(glist_getfont(glist)), 881 sys_hostfontsize(glist_getfont(glist)),
755 "black"); 882 "black");
883#endif
756 } 884 }
885#ifndef ROCKBOX
757 else sys_vgui(".x%x.c delete %x.l\n", glist_getcanvas(glist), x); 886 else sys_vgui(".x%x.c delete %x.l\n", glist_getcanvas(glist), x);
887#endif
758 } 888 }
759} 889}
760 890
@@ -763,6 +893,11 @@ void canvas_atom(t_glist *gl, t_atomtype type,
763{ 893{
764 t_gatom *x = (t_gatom *)pd_new(gatom_class); 894 t_gatom *x = (t_gatom *)pd_new(gatom_class);
765 t_atom at; 895 t_atom at;
896
897#ifdef ROCKBOX
898 (void) s;
899#endif
900
766 x->a_text.te_width = 0; /* don't know it yet. */ 901 x->a_text.te_width = 0; /* don't know it yet. */
767 x->a_text.te_type = T_ATOM; 902 x->a_text.te_type = T_ATOM;
768 x->a_text.te_binbuf = binbuf_new(); 903 x->a_text.te_binbuf = binbuf_new();
@@ -850,11 +985,17 @@ static void gatom_free(t_gatom *x)
850 if (*x->a_symfrom->s_name) 985 if (*x->a_symfrom->s_name)
851 pd_unbind(&x->a_text.te_pd, 986 pd_unbind(&x->a_text.te_pd,
852 canvas_realizedollar(x->a_glist, x->a_symfrom)); 987 canvas_realizedollar(x->a_glist, x->a_symfrom));
988#ifndef ROCKBOX
853 gfxstub_deleteforkey(x); 989 gfxstub_deleteforkey(x);
990#endif
854} 991}
855 992
856static void gatom_properties(t_gobj *z, t_glist *owner) 993static void gatom_properties(t_gobj *z, t_glist *owner)
857{ 994{
995#ifdef ROCKBOX
996 (void) z;
997 (void) owner;
998#else /* ROCKBOX */
858 t_gatom *x = (t_gatom *)z; 999 t_gatom *x = (t_gatom *)z;
859 char buf[200]; 1000 char buf[200];
860 sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n", 1001 sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n",
@@ -863,6 +1004,7 @@ static void gatom_properties(t_gobj *z, t_glist *owner)
863 gatom_escapit(x->a_symfrom)->s_name, 1004 gatom_escapit(x->a_symfrom)->s_name,
864 gatom_escapit(x->a_symto)->s_name); 1005 gatom_escapit(x->a_symto)->s_name);
865 gfxstub_new(&x->a_text.te_pd, x, buf); 1006 gfxstub_new(&x->a_text.te_pd, x, buf);
1007#endif /* ROCKBOX */
866} 1008}
867 1009
868 1010
@@ -880,8 +1022,12 @@ static void text_getrect(t_gobj *z, t_glist *glist,
880 1022
881 if (x->te_type == T_ATOM && x->te_width > 0) 1023 if (x->te_type == T_ATOM && x->te_width > 0)
882 { 1024 {
1025#ifdef ROCKBOX
1026 int fontwidth = 8, fontheight = 10;
1027#else
883 int font = glist_getfont(glist); 1028 int font = glist_getfont(glist);
884 int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); 1029 int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
1030#endif
885 width = (x->te_width > 0 ? x->te_width : 6) * fontwidth + 2; 1031 width = (x->te_width > 0 ? x->te_width : 6) * fontwidth + 2;
886 height = fontheight + 1; /* borrowed from TMARGIN, etc, in g_rtext.c */ 1032 height = fontheight + 1; /* borrowed from TMARGIN, etc, in g_rtext.c */
887 } 1033 }
@@ -933,8 +1079,13 @@ static void text_select(t_gobj *z, t_glist *glist, int state)
933 t_rtext *y = glist_findrtext(glist, x); 1079 t_rtext *y = glist_findrtext(glist, x);
934 rtext_select(y, state); 1080 rtext_select(y, state);
935 if (glist_isvisible(glist) && text_shouldvis(x, glist)) 1081 if (glist_isvisible(glist) && text_shouldvis(x, glist))
1082#ifdef ROCKBOX
1083 {
1084 }
1085#else /* ROCKBOX */
936 sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist, 1086 sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist,
937 rtext_gettag(y), (state? "blue" : "black")); 1087 rtext_gettag(y), (state? "blue" : "black"));
1088#endif /* ROCKBOX */
938} 1089}
939 1090
940static void text_activate(t_gobj *z, t_glist *glist, int state) 1091static void text_activate(t_gobj *z, t_glist *glist, int state)
@@ -988,6 +1139,10 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis)
988static int text_click(t_gobj *z, struct _glist *glist, 1139static int text_click(t_gobj *z, struct _glist *glist,
989 int xpix, int ypix, int shift, int alt, int dbl, int doit) 1140 int xpix, int ypix, int shift, int alt, int dbl, int doit)
990{ 1141{
1142#ifdef ROCKBOX
1143 (void) glist;
1144 (void) dbl;
1145#endif
991 t_text *x = (t_text *)z; 1146 t_text *x = (t_text *)z;
992 if (x->te_type == T_OBJECT) 1147 if (x->te_type == T_OBJECT)
993 { 1148 {
@@ -1111,9 +1266,20 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
1111 char *tag, int x1, int y1, int x2, int y2) 1266 char *tag, int x1, int y1, int x2, int y2)
1112{ 1267{
1113 int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i; 1268 int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i;
1269#ifdef ROCKBOX
1270 (void) glist;
1271 (void) firsttime;
1272 (void) tag;
1273 (void) x1;
1274 (void) y1;
1275 (void) x2;
1276 (void) y2;
1277#else /* ROCKBOX */
1114 int width = x2 - x1; 1278 int width = x2 - x1;
1279#endif /* ROCKBOX */
1115 for (i = 0; i < n; i++) 1280 for (i = 0; i < n; i++)
1116 { 1281 {
1282#ifndef ROCKBOX
1117 int onset = x1 + (width - IOWIDTH) * i / nplus; 1283 int onset = x1 + (width - IOWIDTH) * i / nplus;
1118 if (firsttime) 1284 if (firsttime)
1119 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %so%d\n", 1285 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %so%d\n",
@@ -1126,11 +1292,13 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
1126 glist_getcanvas(glist), tag, i, 1292 glist_getcanvas(glist), tag, i,
1127 onset, y2 - 1, 1293 onset, y2 - 1,
1128 onset + IOWIDTH, y2); 1294 onset + IOWIDTH, y2);
1295#endif /* ROCKBOX */
1129 } 1296 }
1130 n = obj_ninlets(ob); 1297 n = obj_ninlets(ob);
1131 nplus = (n == 1 ? 1 : n-1); 1298 nplus = (n == 1 ? 1 : n-1);
1132 for (i = 0; i < n; i++) 1299 for (i = 0; i < n; i++)
1133 { 1300 {
1301#ifndef ROCKBOX
1134 int onset = x1 + (width - IOWIDTH) * i / nplus; 1302 int onset = x1 + (width - IOWIDTH) * i / nplus;
1135 if (firsttime) 1303 if (firsttime)
1136 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %si%d\n", 1304 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %si%d\n",
@@ -1143,6 +1311,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
1143 glist_getcanvas(glist), tag, i, 1311 glist_getcanvas(glist), tag, i,
1144 onset, y1, 1312 onset, y1,
1145 onset + IOWIDTH, y1 + EXTRAPIX); 1313 onset + IOWIDTH, y1 + EXTRAPIX);
1314#endif /* ROCKBOX */
1146 } 1315 }
1147} 1316}
1148 1317
@@ -1151,11 +1320,18 @@ void text_drawborder(t_text *x, t_glist *glist,
1151{ 1320{
1152 t_object *ob; 1321 t_object *ob;
1153 int x1, y1, x2, y2, width, height; 1322 int x1, y1, x2, y2, width, height;
1323
1324#ifdef ROCKBOX
1325 (void) width2;
1326 (void) height2;
1327#endif
1328
1154 text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2); 1329 text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
1155 width = x2 - x1; 1330 width = x2 - x1;
1156 height = y2 - y1; 1331 height = y2 - y1;
1157 if (x->te_type == T_OBJECT) 1332 if (x->te_type == T_OBJECT)
1158 { 1333 {
1334#ifndef ROCKBOX
1159 if (firsttime) 1335 if (firsttime)
1160 sys_vgui(".x%x.c create line\ 1336 sys_vgui(".x%x.c create line\
1161 %d %d %d %d %d %d %d %d %d %d -tags %sR\n", 1337 %d %d %d %d %d %d %d %d %d %d -tags %sR\n",
@@ -1166,9 +1342,11 @@ void text_drawborder(t_text *x, t_glist *glist,
1166 %d %d %d %d %d %d %d %d %d %d\n", 1342 %d %d %d %d %d %d %d %d %d %d\n",
1167 glist_getcanvas(glist), tag, 1343 glist_getcanvas(glist), tag,
1168 x1, y1, x2, y1, x2, y2, x1, y2, x1, y1); 1344 x1, y1, x2, y1, x2, y2, x1, y2, x1, y1);
1345#endif
1169 } 1346 }
1170 else if (x->te_type == T_MESSAGE) 1347 else if (x->te_type == T_MESSAGE)
1171 { 1348 {
1349#ifndef ROCKBOX
1172 if (firsttime) 1350 if (firsttime)
1173 sys_vgui(".x%x.c create line\ 1351 sys_vgui(".x%x.c create line\
1174 %d %d %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n", 1352 %d %d %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n",
@@ -1182,9 +1360,11 @@ void text_drawborder(t_text *x, t_glist *glist,
1182 glist_getcanvas(glist), tag, 1360 glist_getcanvas(glist), tag,
1183 x1, y1, x2+4, y1, x2, y1+4, x2, y2-4, x2+4, y2, 1361 x1, y1, x2+4, y1, x2, y1+4, x2, y2-4, x2+4, y2,
1184 x1, y2, x1, y1); 1362 x1, y2, x1, y1);
1363#endif
1185 } 1364 }
1186 else if (x->te_type == T_ATOM) 1365 else if (x->te_type == T_ATOM)
1187 { 1366 {
1367#ifndef ROCKBOX
1188 if (firsttime) 1368 if (firsttime)
1189 sys_vgui(".x%x.c create line\ 1369 sys_vgui(".x%x.c create line\
1190 %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n", 1370 %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n",
@@ -1196,31 +1376,46 @@ void text_drawborder(t_text *x, t_glist *glist,
1196 %d %d %d %d %d %d %d %d %d %d %d %d\n", 1376 %d %d %d %d %d %d %d %d %d %d %d %d\n",
1197 glist_getcanvas(glist), tag, 1377 glist_getcanvas(glist), tag,
1198 x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1); 1378 x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1);
1379#endif
1199 } 1380 }
1200 /* draw inlets/outlets */ 1381 /* draw inlets/outlets */
1201 1382
1202 if (ob = pd_checkobject(&x->te_pd)) 1383 if ((ob = pd_checkobject(&x->te_pd)))
1203 glist_drawiofor(glist, ob, firsttime, tag, x1, y1, x2, y2); 1384 glist_drawiofor(glist, ob, firsttime, tag, x1, y1, x2, y2);
1204} 1385}
1205 1386
1206void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag) 1387void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag)
1207{ 1388{
1208 int i, n; 1389 int i, n;
1390#ifdef ROCKBOX
1391 (void) glist;
1392 (void) tag;
1393#endif
1209 n = obj_noutlets(ob); 1394 n = obj_noutlets(ob);
1210 for (i = 0; i < n; i++) 1395 for (i = 0; i < n; i++)
1396#ifdef ROCKBOX
1397 ;
1398#else /* ROCKBOX */
1211 sys_vgui(".x%x.c delete %so%d\n", 1399 sys_vgui(".x%x.c delete %so%d\n",
1212 glist_getcanvas(glist), tag, i); 1400 glist_getcanvas(glist), tag, i);
1401#endif /* ROCKBOX */
1213 n = obj_ninlets(ob); 1402 n = obj_ninlets(ob);
1214 for (i = 0; i < n; i++) 1403 for (i = 0; i < n; i++)
1404#ifdef ROCKBOX
1405 ;
1406#else /* ROCKBOX */
1215 sys_vgui(".x%x.c delete %si%d\n", 1407 sys_vgui(".x%x.c delete %si%d\n",
1216 glist_getcanvas(glist), tag, i); 1408 glist_getcanvas(glist), tag, i);
1409#endif /* ROCKBOX */
1217} 1410}
1218 1411
1219void text_eraseborder(t_text *x, t_glist *glist, char *tag) 1412void text_eraseborder(t_text *x, t_glist *glist, char *tag)
1220{ 1413{
1221 if (x->te_type == T_TEXT) return; 1414 if (x->te_type == T_TEXT) return;
1415#ifndef ROCKBOX
1222 sys_vgui(".x%x.c delete %sR\n", 1416 sys_vgui(".x%x.c delete %sR\n",
1223 glist_getcanvas(glist), tag); 1417 glist_getcanvas(glist), tag);
1418#endif
1224 glist_eraseiofor(glist, x, tag); 1419 glist_eraseiofor(glist, x, tag);
1225} 1420}
1226 1421