Fix pdbox makefile to actually take part in dependency generation
[kugel-rb.git] / apps / plugins / pdbox / PDa / src / g_all_guis.c
bloba50b065a672fc551d6635e353f8cacbdcf004ff2
1 /* Copyright (c) 1997-1999 Miller Puckette.
2 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
3 * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
5 /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */
6 /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
9 #ifdef ROCKBOX
10 #include "plugin.h"
11 #include "../../pdbox.h"
12 #include "m_pd.h"
13 #include "g_canvas.h"
14 #include "g_all_guis.h"
15 #define snprintf rb->snprintf
16 #else /* ROCKBOX */
17 #include <stdlib.h>
18 #include <string.h>
19 #include <stdio.h>
20 #include <ctype.h>
21 #include "m_pd.h"
22 #include "g_canvas.h"
23 #include "t_tk.h"
24 #include "g_all_guis.h"
25 #include <math.h>
27 #ifdef MSW
28 #include <io.h>
29 #else
30 #include <unistd.h>
31 #endif
32 #endif /* ROCKBOX */
34 /* #define GGEE_HSLIDER_COMPATIBLE */
36 /*------------------ global varaibles -------------------------*/
38 int iemgui_color_hex[]=
40 16579836, 10526880, 4210752, 16572640, 16572608,
41 16579784, 14220504, 14220540, 14476540, 16308476,
42 14737632, 8158332, 2105376, 16525352, 16559172,
43 15263784, 1370132, 2684148, 3952892, 16003312,
44 12369084, 6316128, 0, 9177096, 5779456,
45 7874580, 2641940, 17488, 5256, 5767248
48 int iemgui_vu_db2i[]=
50 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
51 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
52 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
53 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
54 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
55 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
56 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
57 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
58 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
59 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
60 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
61 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
62 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
63 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
64 9, 9, 9, 9, 9,10,10,10,10,10,
65 11,11,11,11,11,12,12,12,12,12,
66 13,13,13,13,14,14,14,14,15,15,
67 15,15,16,16,16,16,17,17,17,18,
68 18,18,19,19,19,20,20,20,21,21,
69 22,22,23,23,24,24,25,26,27,28,
70 29,30,31,32,33,33,34,34,35,35,
71 36,36,37,37,37,38,38,38,39,39,
72 39,39,39,39,40,40
75 int iemgui_vu_col[]=
77 0,17,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
78 15,15,15,15,15,15,15,15,15,15,14,14,13,13,13,13,13,13,13,13,13,13,13,19,19,19
81 char *iemgui_vu_scale_str[]=
83 "",
84 "<-99",
85 "",
86 "",
87 "",
88 "-50",
89 "",
90 "",
91 "",
92 "-30",
93 "",
94 "",
95 "",
96 "-20",
97 "",
98 "",
99 "",
100 "-12",
104 "-6",
108 "-2",
112 "-0dB",
116 "+2",
120 "+6",
124 ">+12",
133 /*------------------ global functions -------------------------*/
136 int iemgui_clip_size(int size)
138 if(size < IEM_GUI_MINSIZE)
139 size = IEM_GUI_MINSIZE;
140 return(size);
143 int iemgui_clip_font(int size)
145 if(size < IEM_FONT_MINSIZE)
146 size = IEM_FONT_MINSIZE;
147 return(size);
150 int iemgui_modulo_color(int col)
152 while(col >= IEM_GUI_MAX_COLOR)
153 col -= IEM_GUI_MAX_COLOR;
154 while(col < 0)
155 col += IEM_GUI_MAX_COLOR;
156 return(col);
159 t_symbol *iemgui_raute2dollar(t_symbol *s)
161 if (s->s_name[0] == '#')
163 char buf[MAXPDSTRING];
164 strncpy(buf, s->s_name, MAXPDSTRING);
165 buf[MAXPDSTRING-1] = 0;
166 buf[0] = '$';
167 return (gensym(buf));
169 else return (s);
172 t_symbol *iemgui_dollar2raute(t_symbol *s)
174 if (s->s_name[0] == '$')
176 char buf[MAXPDSTRING];
177 strncpy(buf, s->s_name, MAXPDSTRING);
178 buf[MAXPDSTRING-1] = 0;
179 buf[0] = '#';
180 return (gensym(buf));
182 else return (s);
185 void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui)
187 iemgui->x_fsf.x_put_in2out = 1;
188 if(iemgui->x_fsf.x_snd_able && iemgui->x_fsf.x_rcv_able)
190 if(!strcmp(iemgui->x_snd->s_name, iemgui->x_rcv->s_name))
191 iemgui->x_fsf.x_put_in2out = 0;
195 t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv)
197 #ifdef ROCKBOX
198 (void) iemgui;
199 #endif
200 if (IS_A_SYMBOL(argv, indx))
201 return (atom_getsymbolarg(indx, 100000, argv));
202 else if (IS_A_FLOAT(argv, indx))
204 char str[80];
205 #ifdef ROCKBOX
206 snprintf(str, sizeof(str), "%d",
207 (int) atom_getintarg(indx, 100000, argv));
208 #else
209 sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv));
210 #endif
211 return (gensym(str));
213 else return (gensym("empty"));
216 void iemgui_new_getnames(t_iemgui *iemgui, int indx, t_atom *argv)
218 if (argv)
220 iemgui->x_snd = iemgui_new_dogetname(iemgui, indx, argv);
221 iemgui->x_rcv = iemgui_new_dogetname(iemgui, indx+1, argv);
222 iemgui->x_lab = iemgui_new_dogetname(iemgui, indx+2, argv);
224 else iemgui->x_snd = iemgui->x_rcv = iemgui->x_lab = gensym("empty");
225 iemgui->x_snd_unexpanded = iemgui->x_rcv_unexpanded =
226 iemgui->x_lab_unexpanded = 0;
227 iemgui->x_binbufindex = indx;
228 iemgui->x_labelbindex = indx + 3;
231 /* convert symbols in "$" form to the expanded symbols */
232 void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
234 /* save unexpanded ones for later */
235 iemgui->x_snd_unexpanded = srlsym[0];
236 iemgui->x_rcv_unexpanded = srlsym[1];
237 iemgui->x_lab_unexpanded = srlsym[2];
238 srlsym[0] = canvas_realizedollar(iemgui->x_glist, srlsym[0]);
239 srlsym[1] = canvas_realizedollar(iemgui->x_glist, srlsym[1]);
240 srlsym[2] = canvas_realizedollar(iemgui->x_glist, srlsym[2]);
243 /* initialize a single symbol in unexpanded form. We reach into the
244 binbuf to grab them; if there's nothing there, set it to the
245 fallback; if still nothing, set to "empty". */
246 static void iemgui_init_sym2dollararg(t_iemgui *iemgui, t_symbol **symp,
247 int indx, t_symbol *fallback)
249 if (!*symp)
251 t_binbuf *b = iemgui->x_obj.ob_binbuf;
252 if (binbuf_getnatom(b) > indx)
254 char buf[80];
255 atom_string(binbuf_getvec(b) + indx, buf, 80);
256 *symp = gensym(buf);
258 else if (fallback)
259 *symp = fallback;
260 else *symp = gensym("empty");
264 /* get the unexpanded versions of the symbols; initialize them if
265 necessary. */
266 void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym)
268 iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded,
269 iemgui->x_binbufindex+1, iemgui->x_snd);
270 iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded,
271 iemgui->x_binbufindex+2, iemgui->x_rcv);
272 iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded,
273 iemgui->x_labelbindex, iemgui->x_lab);
274 srlsym[0] = iemgui->x_snd_unexpanded;
275 srlsym[1] = iemgui->x_rcv_unexpanded;
276 srlsym[2] = iemgui->x_lab_unexpanded;
279 void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
281 #ifdef ROCKBOX
282 (void) iemgui;
283 (void) srlsym;
284 #endif
285 /* delete this function */
288 void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol)
290 bflcol[0] = -1 - (((0xfc0000 & iemgui->x_bcol) >> 6)|
291 ((0xfc00 & iemgui->x_bcol) >> 4)|((0xfc & iemgui->x_bcol) >> 2));
292 bflcol[1] = -1 - (((0xfc0000 & iemgui->x_fcol) >> 6)|
293 ((0xfc00 & iemgui->x_fcol) >> 4)|((0xfc & iemgui->x_fcol) >> 2));
294 bflcol[2] = -1 - (((0xfc0000 & iemgui->x_lcol) >> 6)|
295 ((0xfc00 & iemgui->x_lcol) >> 4)|((0xfc & iemgui->x_lcol) >> 2));
298 void iemgui_all_colfromload(t_iemgui *iemgui, int *bflcol)
300 if(bflcol[0] < 0)
302 bflcol[0] = -1 - bflcol[0];
303 iemgui->x_bcol = ((bflcol[0] & 0x3f000) << 6)|((bflcol[0] & 0xfc0) << 4)|
304 ((bflcol[0] & 0x3f) << 2);
306 else
308 bflcol[0] = iemgui_modulo_color(bflcol[0]);
309 iemgui->x_bcol = iemgui_color_hex[bflcol[0]];
311 if(bflcol[1] < 0)
313 bflcol[1] = -1 - bflcol[1];
314 iemgui->x_fcol = ((bflcol[1] & 0x3f000) << 6)|((bflcol[1] & 0xfc0) << 4)|
315 ((bflcol[1] & 0x3f) << 2);
317 else
319 bflcol[1] = iemgui_modulo_color(bflcol[1]);
320 iemgui->x_fcol = iemgui_color_hex[bflcol[1]];
322 if(bflcol[2] < 0)
324 bflcol[2] = -1 - bflcol[2];
325 iemgui->x_lcol = ((bflcol[2] & 0x3f000) << 6)|((bflcol[2] & 0xfc0) << 4)|
326 ((bflcol[2] & 0x3f) << 2);
328 else
330 bflcol[2] = iemgui_modulo_color(bflcol[2]);
331 iemgui->x_lcol = iemgui_color_hex[bflcol[2]];
335 int iemgui_compatible_col(int i)
337 int j;
339 if(i >= 0)
341 j = iemgui_modulo_color(i);
342 return(iemgui_color_hex[(j)]);
344 else
345 return((-1 -i)&0xffffff);
348 void iemgui_all_dollar2raute(t_symbol **srlsym)
350 srlsym[0] = iemgui_dollar2raute(srlsym[0]);
351 srlsym[1] = iemgui_dollar2raute(srlsym[1]);
352 srlsym[2] = iemgui_dollar2raute(srlsym[2]);
355 void iemgui_all_raute2dollar(t_symbol **srlsym)
357 srlsym[0] = iemgui_raute2dollar(srlsym[0]);
358 srlsym[1] = iemgui_raute2dollar(srlsym[1]);
359 srlsym[2] = iemgui_raute2dollar(srlsym[2]);
362 void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s)
364 t_symbol *snd;
365 #ifdef ROCKBOX
366 int sndable=1, oldsndrcvable=0;
367 #else
368 int pargc, tail_len, nth_arg, sndable=1, oldsndrcvable=0;
369 t_atom *pargv;
370 #endif
372 if(iemgui->x_fsf.x_rcv_able)
373 oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
374 if(iemgui->x_fsf.x_snd_able)
375 oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
377 if(!strcmp(s->s_name, "empty")) sndable = 0;
378 snd = iemgui_raute2dollar(s);
379 iemgui->x_snd_unexpanded = snd;
380 iemgui->x_snd = snd = canvas_realizedollar(iemgui->x_glist, snd);
381 post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name,
382 iemgui->x_snd->s_name);
384 iemgui->x_fsf.x_snd_able = sndable;
385 iemgui_verify_snd_ne_rcv(iemgui);
386 (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable);
389 void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s)
391 t_symbol *rcv;
392 #ifdef ROCKBOX
393 int rcvable=1, oldsndrcvable=0;
394 #else
395 int pargc, tail_len, nth_arg, rcvable=1, oldsndrcvable=0;
396 t_atom *pargv;
397 #endif
399 if(iemgui->x_fsf.x_rcv_able)
400 oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
401 if(iemgui->x_fsf.x_snd_able)
402 oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
404 if(!strcmp(s->s_name, "empty")) rcvable = 0;
405 rcv = iemgui_raute2dollar(s);
406 iemgui->x_rcv_unexpanded = rcv;
407 iemgui->x_rcv = rcv = canvas_realizedollar(iemgui->x_glist, rcv);
408 if(rcvable)
410 if(strcmp(rcv->s_name, iemgui->x_rcv->s_name))
412 if(iemgui->x_fsf.x_rcv_able)
413 pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv);
414 iemgui->x_rcv = rcv;
415 pd_bind(&iemgui->x_obj.ob_pd, iemgui->x_rcv);
418 else if(!rcvable && iemgui->x_fsf.x_rcv_able)
420 pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv);
421 iemgui->x_rcv = rcv;
423 iemgui->x_fsf.x_rcv_able = rcvable;
424 iemgui_verify_snd_ne_rcv(iemgui);
425 (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable);
428 void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s)
430 t_symbol *lab;
431 #ifndef ROCKBOX
432 int pargc, tail_len, nth_arg;
433 t_atom *pargv;
434 #endif
436 #ifdef ROCKBOX
437 (void) x;
438 #endif
440 lab = iemgui_raute2dollar(s);
441 iemgui->x_lab_unexpanded = lab;
442 iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
444 #ifndef ROCKBOX
445 if(glist_isvisible(iemgui->x_glist))
446 sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n",
447 glist_getcanvas(iemgui->x_glist), x,
448 strcmp(s->s_name, "empty")?iemgui->x_lab->s_name:"");
449 #endif
452 void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
454 #ifdef ROCKBOX
455 (void) x;
456 (void) s;
457 #endif
459 iemgui->x_ldx = (int)atom_getintarg(0, ac, av);
460 iemgui->x_ldy = (int)atom_getintarg(1, ac, av);
462 #ifndef ROCKBOX
463 if(glist_isvisible(iemgui->x_glist))
464 sys_vgui(".x%x.c coords %xLABEL %d %d\n",
465 glist_getcanvas(iemgui->x_glist), x,
466 iemgui->x_obj.te_xpix+iemgui->x_ldx,
467 iemgui->x_obj.te_ypix+iemgui->x_ldy);
468 #endif
471 void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
473 int f = (int)atom_getintarg(0, ac, av);
475 #ifdef ROCKBOX
476 (void) x;
477 (void) s;
478 #endif
480 if(f == 1) strcpy(iemgui->x_font, "helvetica");
481 else if(f == 2) strcpy(iemgui->x_font, "times");
482 else
484 f = 0;
485 strcpy(iemgui->x_font, "courier");
487 iemgui->x_fsf.x_font_style = f;
488 f = (int)atom_getintarg(1, ac, av);
489 if(f < 4)
490 f = 4;
491 iemgui->x_fontsize = f;
492 #ifndef ROCKBOX
493 if(glist_isvisible(iemgui->x_glist))
494 sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n",
495 glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, iemgui->x_fontsize);
496 #endif
499 void iemgui_size(void *x, t_iemgui *iemgui)
501 if(glist_isvisible(iemgui->x_glist))
503 (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE);
504 canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
508 void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
510 #ifdef ROCKBOX
511 (void) s;
512 #endif
513 iemgui->x_obj.te_xpix += (int)atom_getintarg(0, ac, av);
514 iemgui->x_obj.te_ypix += (int)atom_getintarg(1, ac, av);
515 if(glist_isvisible(iemgui->x_glist))
517 (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE);
518 canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
522 void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
524 #ifdef ROCKBOX
525 (void) s;
526 #endif
527 iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av);
528 iemgui->x_obj.te_ypix = (int)atom_getintarg(1, ac, av);
529 if(glist_isvisible(iemgui->x_glist))
531 (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE);
532 canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
536 void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
538 #ifdef ROCKBOX
539 (void) s;
540 #endif
541 iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av));
542 if(ac > 2)
544 iemgui->x_fcol = iemgui_compatible_col(atom_getintarg(1, ac, av));
545 iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(2, ac, av));
547 else
548 iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(1, ac, av));
549 if(glist_isvisible(iemgui->x_glist))
550 (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_CONFIG);
553 void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy)
555 t_iemguidummy *x = (t_iemguidummy *)z;
557 x->x_gui.x_obj.te_xpix += dx;
558 x->x_gui.x_obj.te_ypix += dy;
559 (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_MOVE);
560 canvas_fixlinesfor(glist_getcanvas(glist), (t_text *)z);
563 void iemgui_select(t_gobj *z, t_glist *glist, int selected)
565 t_iemguidummy *x = (t_iemguidummy *)z;
567 x->x_gui.x_fsf.x_selected = selected;
568 (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT);
571 void iemgui_delete(t_gobj *z, t_glist *glist)
573 canvas_deletelinesfor(glist, (t_text *)z);
576 void iemgui_vis(t_gobj *z, t_glist *glist, int vis)
578 t_iemguidummy *x = (t_iemguidummy *)z;
580 if (vis)
581 (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_NEW);
582 else
583 (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_ERASE);
586 void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol)
588 srl[0] = iemgui->x_snd;
589 srl[1] = iemgui->x_rcv;
590 srl[2] = iemgui->x_lab;
591 iemgui_all_sym2dollararg(iemgui, srl);
592 iemgui_all_col2save(iemgui, bflcol);
595 void iemgui_properties(t_iemgui *iemgui, t_symbol **srl)
597 srl[0] = iemgui->x_snd;
598 srl[1] = iemgui->x_rcv;
599 srl[2] = iemgui->x_lab;
600 iemgui_all_sym2dollararg(iemgui, srl);
601 iemgui_all_dollar2raute(srl);
604 int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
606 char str[144];
607 int init = (int)atom_getintarg(5, argc, argv);
608 int ldx = (int)atom_getintarg(10, argc, argv);
609 int ldy = (int)atom_getintarg(11, argc, argv);
610 int f = (int)atom_getintarg(12, argc, argv);
611 int fs = (int)atom_getintarg(13, argc, argv);
612 int bcol = (int)atom_getintarg(14, argc, argv);
613 int fcol = (int)atom_getintarg(15, argc, argv);
614 int lcol = (int)atom_getintarg(16, argc, argv);
615 int sndable=1, rcvable=1, oldsndrcvable=0;
617 if(iemgui->x_fsf.x_rcv_able)
618 oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
619 if(iemgui->x_fsf.x_snd_able)
620 oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
621 if(IS_A_SYMBOL(argv,7))
622 srl[0] = atom_getsymbolarg(7, argc, argv);
623 else if(IS_A_FLOAT(argv,7))
625 #ifdef ROCKBOX
626 snprintf(str, sizeof(str), "%d", (int) atom_getintarg(7, argc, argv));
627 #else
628 sprintf(str, "%d", (int)atom_getintarg(7, argc, argv));
629 #endif
630 srl[0] = gensym(str);
632 if(IS_A_SYMBOL(argv,8))
633 srl[1] = atom_getsymbolarg(8, argc, argv);
634 else if(IS_A_FLOAT(argv,8))
636 #ifdef ROCKBOX
637 snprintf(str, sizeof(str), "%d", (int) atom_getintarg(8, argc, argv));
638 #else
639 sprintf(str, "%d", (int)atom_getintarg(8, argc, argv));
640 #endif
641 srl[1] = gensym(str);
643 if(IS_A_SYMBOL(argv,9))
644 srl[2] = atom_getsymbolarg(9, argc, argv);
645 else if(IS_A_FLOAT(argv,9))
647 #ifdef ROCKBOX
648 snprintf(str, sizeof(str), "%d", (int) atom_getintarg(9, argc, argv));
649 #else
650 sprintf(str, "%d", (int)atom_getintarg(9, argc, argv));
651 #endif
652 srl[2] = gensym(str);
654 if(init != 0) init = 1;
655 iemgui->x_isa.x_loadinit = init;
656 if(!strcmp(srl[0]->s_name, "empty")) sndable = 0;
657 if(!strcmp(srl[1]->s_name, "empty")) rcvable = 0;
658 iemgui_all_raute2dollar(srl);
659 iemgui_all_dollararg2sym(iemgui, srl);
660 if(rcvable)
662 if(strcmp(srl[1]->s_name, iemgui->x_rcv->s_name))
664 if(iemgui->x_fsf.x_rcv_able)
665 pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv);
666 iemgui->x_rcv = srl[1];
667 pd_bind(&iemgui->x_obj.ob_pd, iemgui->x_rcv);
670 else if(!rcvable && iemgui->x_fsf.x_rcv_able)
672 pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv);
673 iemgui->x_rcv = srl[1];
675 iemgui->x_snd = srl[0];
676 iemgui->x_fsf.x_snd_able = sndable;
677 iemgui->x_fsf.x_rcv_able = rcvable;
678 iemgui->x_lcol = lcol & 0xffffff;
679 iemgui->x_fcol = fcol & 0xffffff;
680 iemgui->x_bcol = bcol & 0xffffff;
681 iemgui->x_lab = srl[2];
682 iemgui->x_ldx = ldx;
683 iemgui->x_ldy = ldy;
684 if(f == 1) strcpy(iemgui->x_font, "helvetica");
685 else if(f == 2) strcpy(iemgui->x_font, "times");
686 else
688 f = 0;
689 strcpy(iemgui->x_font, "courier");
691 iemgui->x_fsf.x_font_style = f;
692 if(fs < 4)
693 fs = 4;
694 iemgui->x_fontsize = fs;
695 iemgui_verify_snd_ne_rcv(iemgui);
696 return(oldsndrcvable);
699 void iem_inttosymargs(t_iem_init_symargs *symargp, int n)
701 memset(symargp, 0, sizeof(*symargp));
702 symargp->x_loadinit = (n >> 0);
703 symargp->x_scale = (n >> 20);
704 symargp->x_flashed = 0;
705 symargp->x_locked = 0;
706 symargp->x_reverse = 0;
707 symargp->dummy = 0;
710 int iem_symargstoint(t_iem_init_symargs *symargp)
712 return (
713 (((symargp->x_loadinit & 1) << 0) |
714 ((symargp->x_scale & 1) << 20)));
717 void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n)
719 memset(fstylep, 0, sizeof(*fstylep));
720 fstylep->x_font_style = (n >> 0);
721 fstylep->x_shiftdown = 0;
722 fstylep->x_selected = 0;
723 fstylep->x_finemoved = 0;
724 fstylep->x_put_in2out = 0;
725 fstylep->x_change = 0;
726 fstylep->x_thick = 0;
727 fstylep->x_lin0_log1 = 0;
728 fstylep->x_steady = 0;
729 fstylep->dummy = 0;
732 int iem_fstyletoint(t_iem_fstyle_flags *fstylep)
734 return ((fstylep->x_font_style << 0) & 63);