summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/g_toggle.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_toggle.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/g_toggle.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_toggle.c b/apps/plugins/pdbox/PDa/src/g_toggle.c
index 5a3401ffa8..e3e2f05098 100644
--- a/apps/plugins/pdbox/PDa/src/g_toggle.c
+++ b/apps/plugins/pdbox/PDa/src/g_toggle.c
@@ -6,6 +6,13 @@
6/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ 6/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
7 7
8 8
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#else /* ROCKBOX */
9#include <stdlib.h> 16#include <stdlib.h>
10#include <string.h> 17#include <string.h>
11#include <stdio.h> 18#include <stdio.h>
@@ -21,6 +28,7 @@
21#else 28#else
22#include <unistd.h> 29#include <unistd.h>
23#endif 30#endif
31#endif /* ROCKBOX */
24 32
25/* --------------- tgl gui-toggle ------------------------- */ 33/* --------------- tgl gui-toggle ------------------------- */
26 34
@@ -31,6 +39,10 @@ static t_class *toggle_class;
31 39
32void toggle_draw_update(t_toggle *x, t_glist *glist) 40void toggle_draw_update(t_toggle *x, t_glist *glist)
33{ 41{
42#ifdef ROCKBOX
43 (void) x;
44 (void) glist;
45#else /* ROCKBOX */
34 if(glist_isvisible(glist)) 46 if(glist_isvisible(glist))
35 { 47 {
36 t_canvas *canvas=glist_getcanvas(glist); 48 t_canvas *canvas=glist_getcanvas(glist);
@@ -40,10 +52,15 @@ void toggle_draw_update(t_toggle *x, t_glist *glist)
40 sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, 52 sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x,
41 (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); 53 (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol);
42 } 54 }
55#endif /* ROCKBOX */
43} 56}
44 57
45void toggle_draw_new(t_toggle *x, t_glist *glist) 58void toggle_draw_new(t_toggle *x, t_glist *glist)
46{ 59{
60#ifdef ROCKBOX
61 (void) x;
62 (void) glist;
63#else /* ROCKBOX */
47 t_canvas *canvas=glist_getcanvas(glist); 64 t_canvas *canvas=glist_getcanvas(glist);
48 int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); 65 int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist);
49 66
@@ -72,10 +89,15 @@ void toggle_draw_new(t_toggle *x, t_glist *glist)
72 if(!x->x_gui.x_fsf.x_rcv_able) 89 if(!x->x_gui.x_fsf.x_rcv_able)
73 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", 90 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
74 canvas, xx, yy, xx + IOWIDTH, yy+1, x, 0); 91 canvas, xx, yy, xx + IOWIDTH, yy+1, x, 0);
92#endif /* ROCKBOX */
75} 93}
76 94
77void toggle_draw_move(t_toggle *x, t_glist *glist) 95void toggle_draw_move(t_toggle *x, t_glist *glist)
78{ 96{
97#ifdef ROCKBOX
98 (void) x;
99 (void) glist;
100#else /* ROCKBOX */
79 t_canvas *canvas=glist_getcanvas(glist); 101 t_canvas *canvas=glist_getcanvas(glist);
80 int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); 102 int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist);
81 103
@@ -100,10 +122,15 @@ void toggle_draw_move(t_toggle *x, t_glist *glist)
100 if(!x->x_gui.x_fsf.x_rcv_able) 122 if(!x->x_gui.x_fsf.x_rcv_able)
101 sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", 123 sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
102 canvas, x, 0, xx, yy, xx + IOWIDTH, yy+1); 124 canvas, x, 0, xx, yy, xx + IOWIDTH, yy+1);
125#endif /* ROCKBOX */
103} 126}
104 127
105void toggle_draw_erase(t_toggle* x, t_glist* glist) 128void toggle_draw_erase(t_toggle* x, t_glist* glist)
106{ 129{
130#ifdef ROCKBOX
131 (void) x;
132 (void) glist;
133#else /* ROCKBOX */
107 t_canvas *canvas=glist_getcanvas(glist); 134 t_canvas *canvas=glist_getcanvas(glist);
108 135
109 sys_vgui(".x%x.c delete %xBASE\n", canvas, x); 136 sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
@@ -114,10 +141,15 @@ void toggle_draw_erase(t_toggle* x, t_glist* glist)
114 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); 141 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
115 if(!x->x_gui.x_fsf.x_rcv_able) 142 if(!x->x_gui.x_fsf.x_rcv_able)
116 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 143 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
144#endif /* ROCKBOX */
117} 145}
118 146
119void toggle_draw_config(t_toggle* x, t_glist* glist) 147void toggle_draw_config(t_toggle* x, t_glist* glist)
120{ 148{
149#ifdef ROCKBOX
150 (void) x;
151 (void) glist;
152#else /* ROCKBOX */
121 t_canvas *canvas=glist_getcanvas(glist); 153 t_canvas *canvas=glist_getcanvas(glist);
122 154
123 sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", 155 sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
@@ -130,10 +162,16 @@ void toggle_draw_config(t_toggle* x, t_glist* glist)
130 x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); 162 x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
131 sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, 163 sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x,
132 x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); 164 x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol);
165#endif /* ROCKBOX */
133} 166}
134 167
135void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags) 168void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags)
136{ 169{
170#ifdef ROCKBOX
171 (void) x;
172 (void) glist;
173 (void) old_snd_rcv_flags;
174#else /* ROCKBOX */
137 int xpos=text_xpix(&x->x_gui.x_obj, glist); 175 int xpos=text_xpix(&x->x_gui.x_obj, glist);
138 int ypos=text_ypix(&x->x_gui.x_obj, glist); 176 int ypos=text_ypix(&x->x_gui.x_obj, glist);
139 t_canvas *canvas=glist_getcanvas(glist); 177 t_canvas *canvas=glist_getcanvas(glist);
@@ -151,10 +189,15 @@ void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags)
151 xpos + IOWIDTH, ypos+1, x, 0); 189 xpos + IOWIDTH, ypos+1, x, 0);
152 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) 190 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
153 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 191 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
192#endif /* ROCKBOX */
154} 193}
155 194
156void toggle_draw_select(t_toggle* x, t_glist* glist) 195void toggle_draw_select(t_toggle* x, t_glist* glist)
157{ 196{
197#ifdef ROCKBOX
198 (void) x;
199 (void) glist;
200#else /* ROCKBOX */
158 t_canvas *canvas=glist_getcanvas(glist); 201 t_canvas *canvas=glist_getcanvas(glist);
159 202
160 if(x->x_gui.x_fsf.x_selected) 203 if(x->x_gui.x_fsf.x_selected)
@@ -167,6 +210,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist)
167 sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); 210 sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
168 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); 211 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
169 } 212 }
213#endif /* ROCKBOX */
170} 214}
171 215
172void toggle_draw(t_toggle *x, t_glist *glist, int mode) 216void toggle_draw(t_toggle *x, t_glist *glist, int mode)
@@ -220,6 +264,10 @@ static void toggle_save(t_gobj *z, t_binbuf *b)
220 264
221static void toggle_properties(t_gobj *z, t_glist *owner) 265static void toggle_properties(t_gobj *z, t_glist *owner)
222{ 266{
267#ifdef ROCKBOX
268 (void) z;
269 (void) owner;
270#else /* ROCKBOX */
223 t_toggle *x = (t_toggle *)z; 271 t_toggle *x = (t_toggle *)z;
224 char buf[800]; 272 char buf[800];
225 t_symbol *srl[3]; 273 t_symbol *srl[3];
@@ -241,6 +289,7 @@ static void toggle_properties(t_gobj *z, t_glist *owner)
241 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 289 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
242 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); 290 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
243 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); 291 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
292#endif
244} 293}
245 294
246static void toggle_bang(t_toggle *x) 295static void toggle_bang(t_toggle *x)
@@ -259,6 +308,10 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv)
259 float nonzero = (float)atom_getfloatarg(2, argc, argv); 308 float nonzero = (float)atom_getfloatarg(2, argc, argv);
260 int sr_flags; 309 int sr_flags;
261 310
311#ifdef ROCKBOX
312 (void) s;
313#endif
314
262 if(nonzero == 0.0) 315 if(nonzero == 0.0)
263 nonzero = 1.0; 316 nonzero = 1.0;
264 x->x_nonzero = nonzero; 317 x->x_nonzero = nonzero;
@@ -274,10 +327,26 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv)
274} 327}
275 328
276static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) 329static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
330#ifdef ROCKBOX
331{
332 (void) xpos;
333 (void) ypos;
334 (void) shift;
335 (void) alt;
336 (void) ctrl;
337
338 toggle_bang(x);
339}
340#else /* ROCKBOX */
277{toggle_bang(x);} 341{toggle_bang(x);}
342#endif /* ROCKBOX */
278 343
279static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) 344static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
280{ 345{
346#ifdef ROCKBOX
347 (void) glist;
348 (void) dbl;
349#endif
281 if(doit) 350 if(doit)
282 toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); 351 toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
283 return (1); 352 return (1);
@@ -318,6 +387,9 @@ static void toggle_loadbang(t_toggle *x)
318 387
319static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av) 388static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av)
320{ 389{
390#ifdef ROCKBOX
391 (void) s;
392#endif
321 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); 393 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
322 x->x_gui.x_h = x->x_gui.x_w; 394 x->x_gui.x_h = x->x_gui.x_w;
323 iemgui_size((void *)x, &x->x_gui); 395 iemgui_size((void *)x, &x->x_gui);
@@ -362,11 +434,21 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
362{ 434{
363 t_toggle *x = (t_toggle *)pd_new(toggle_class); 435 t_toggle *x = (t_toggle *)pd_new(toggle_class);
364 int bflcol[]={-262144, -1, -1}; 436 int bflcol[]={-262144, -1, -1};
437#ifdef ROCKBOX
438 int a=IEM_GUI_DEFAULTSIZE;
439#else
365 int a=IEM_GUI_DEFAULTSIZE, f=0; 440 int a=IEM_GUI_DEFAULTSIZE, f=0;
441#endif
366 int ldx=0, ldy=-6; 442 int ldx=0, ldy=-6;
367 int fs=8; 443 int fs=8;
368 float on=0.0, nonzero=1.0; 444 float on=0.0, nonzero=1.0;
445#ifndef ROCKBOX
369 char str[144]; 446 char str[144];
447#endif
448
449#ifdef ROCKBOX
450 (void) s;
451#endif
370 452
371 iem_inttosymargs(&x->x_gui.x_isa, 0); 453 iem_inttosymargs(&x->x_gui.x_isa, 0);
372 iem_inttofstyle(&x->x_gui.x_fsf, 0); 454 iem_inttofstyle(&x->x_gui.x_fsf, 0);
@@ -433,7 +515,9 @@ static void toggle_ff(t_toggle *x)
433{ 515{
434 if(x->x_gui.x_fsf.x_rcv_able) 516 if(x->x_gui.x_fsf.x_rcv_able)
435 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); 517 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
518#ifndef ROCKBOX
436 gfxstub_deleteforkey(x); 519 gfxstub_deleteforkey(x);
520#endif
437} 521}
438 522
439void g_toggle_setup(void) 523void g_toggle_setup(void)