summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/g_hdial.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_hdial.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/g_hdial.c81
1 files changed, 79 insertions, 2 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_hdial.c b/apps/plugins/pdbox/PDa/src/g_hdial.c
index eb88f22e2d..4bf2e0ad50 100644
--- a/apps/plugins/pdbox/PDa/src/g_hdial.c
+++ b/apps/plugins/pdbox/PDa/src/g_hdial.c
@@ -8,6 +8,13 @@
8/* name change to hradio by MSP and changed to 8/* name change to hradio by MSP and changed to
9put out a "float" as in sliders, toggles, etc. */ 9put out a "float" as in sliders, toggles, etc. */
10 10
11#ifdef ROCKBOX
12#include "plugin.h"
13#include "pdbox.h"
14#include "m_pd.h"
15#include "g_canvas.h"
16#include "g_all_guis.h"
17#else /* ROCKBOX */
11#include <stdlib.h> 18#include <stdlib.h>
12#include <string.h> 19#include <string.h>
13#include <stdio.h> 20#include <stdio.h>
@@ -23,6 +30,7 @@ put out a "float" as in sliders, toggles, etc. */
23#else 30#else
24#include <unistd.h> 31#include <unistd.h>
25#endif 32#endif
33#endif /* ROCKBOX */
26 34
27/* ------------- hdl gui-horicontal dial ---------------------- */ 35/* ------------- hdl gui-horicontal dial ---------------------- */
28 36
@@ -33,6 +41,10 @@ static t_class *hradio_class, *hradio_old_class;
33 41
34void hradio_draw_update(t_hradio *x, t_glist *glist) 42void hradio_draw_update(t_hradio *x, t_glist *glist)
35{ 43{
44#ifdef ROCKBOX
45 (void) x;
46 (void) glist;
47#else /* ROCKBOX */
36 if(glist_isvisible(glist)) 48 if(glist_isvisible(glist))
37 { 49 {
38 t_canvas *canvas=glist_getcanvas(glist); 50 t_canvas *canvas=glist_getcanvas(glist);
@@ -44,10 +56,15 @@ void hradio_draw_update(t_hradio *x, t_glist *glist)
44 canvas, x, x->x_on, 56 canvas, x, x->x_on,
45 x->x_gui.x_fcol, x->x_gui.x_fcol); 57 x->x_gui.x_fcol, x->x_gui.x_fcol);
46 } 58 }
59#endif /* ROCKBOX */
47} 60}
48 61
49void hradio_draw_new(t_hradio *x, t_glist *glist) 62void hradio_draw_new(t_hradio *x, t_glist *glist)
50{ 63{
64#ifdef ROCKBOX
65 (void) x;
66 (void) glist;
67#else /* ROCKBOX */
51 t_canvas *canvas=glist_getcanvas(glist); 68 t_canvas *canvas=glist_getcanvas(glist);
52 int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; 69 int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4;
53 int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx; 70 int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx;
@@ -55,7 +72,6 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
55 int xx11b=text_xpix(&x->x_gui.x_obj, glist), xx11=xx11b, xx21=xx11b+s4; 72 int xx11b=text_xpix(&x->x_gui.x_obj, glist), xx11=xx11b, xx21=xx11b+s4;
56 int xx22=xx11b+dx-s4; 73 int xx22=xx11b+dx-s4;
57 74
58
59 for(i=0; i<n; i++) 75 for(i=0; i<n; i++)
60 { 76 {
61 sys_vgui(".x%x.c create rectangle %d %d %d %d -fill #%6.6x -tags %xBASE%d\n", 77 sys_vgui(".x%x.c create rectangle %d %d %d %d -fill #%6.6x -tags %xBASE%d\n",
@@ -81,11 +97,15 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
81 if(!x->x_gui.x_fsf.x_rcv_able) 97 if(!x->x_gui.x_fsf.x_rcv_able)
82 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", 98 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
83 canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, 0); 99 canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, 0);
84 100#endif /* ROCKBOX */
85} 101}
86 102
87void hradio_draw_move(t_hradio *x, t_glist *glist) 103void hradio_draw_move(t_hradio *x, t_glist *glist)
88{ 104{
105#ifdef ROCKBOX
106 (void) x;
107 (void) glist;
108#else /* ROCKBOX */
89 t_canvas *canvas=glist_getcanvas(glist); 109 t_canvas *canvas=glist_getcanvas(glist);
90 int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; 110 int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4;
91 int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx; 111 int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx;
@@ -114,10 +134,15 @@ void hradio_draw_move(t_hradio *x, t_glist *glist)
114 if(!x->x_gui.x_fsf.x_rcv_able) 134 if(!x->x_gui.x_fsf.x_rcv_able)
115 sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", 135 sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
116 canvas, x, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1); 136 canvas, x, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1);
137#endif /* ROCKBOX */
117} 138}
118 139
119void hradio_draw_erase(t_hradio* x, t_glist* glist) 140void hradio_draw_erase(t_hradio* x, t_glist* glist)
120{ 141{
142#ifdef ROCKBOX
143 (void) x;
144 (void) glist;
145#else /* ROCKBOX */
121 t_canvas *canvas=glist_getcanvas(glist); 146 t_canvas *canvas=glist_getcanvas(glist);
122 int n=x->x_number, i; 147 int n=x->x_number, i;
123 148
@@ -131,10 +156,15 @@ void hradio_draw_erase(t_hradio* x, t_glist* glist)
131 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); 156 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
132 if(!x->x_gui.x_fsf.x_rcv_able) 157 if(!x->x_gui.x_fsf.x_rcv_able)
133 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 158 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
159#endif /* ROCKBOX */
134} 160}
135 161
136void hradio_draw_config(t_hradio* x, t_glist* glist) 162void hradio_draw_config(t_hradio* x, t_glist* glist)
137{ 163{
164#ifdef ROCKBOX
165 (void) x;
166 (void) glist;
167#else /* ROCKBOX */
138 t_canvas *canvas=glist_getcanvas(glist); 168 t_canvas *canvas=glist_getcanvas(glist);
139 int n=x->x_number, i; 169 int n=x->x_number, i;
140 170
@@ -150,10 +180,16 @@ void hradio_draw_config(t_hradio* x, t_glist* glist)
150 (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, 180 (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol,
151 (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); 181 (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol);
152 } 182 }
183#endif
153} 184}
154 185
155void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) 186void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
156{ 187{
188#ifdef ROCKBOX
189 (void) x;
190 (void) glist;
191 (void) old_snd_rcv_flags;
192#else /* ROCKBOX */
157 t_canvas *canvas=glist_getcanvas(glist); 193 t_canvas *canvas=glist_getcanvas(glist);
158 int xpos=text_xpix(&x->x_gui.x_obj, glist); 194 int xpos=text_xpix(&x->x_gui.x_obj, glist);
159 int ypos=text_ypix(&x->x_gui.x_obj, glist); 195 int ypos=text_ypix(&x->x_gui.x_obj, glist);
@@ -173,10 +209,15 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
173 xpos + IOWIDTH, ypos+1, x, 0); 209 xpos + IOWIDTH, ypos+1, x, 0);
174 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) 210 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
175 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 211 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
212#endif /* ROCKBOX */
176} 213}
177 214
178void hradio_draw_select(t_hradio* x, t_glist* glist) 215void hradio_draw_select(t_hradio* x, t_glist* glist)
179{ 216{
217#ifdef ROCKBOX
218 (void) x;
219 (void) glist;
220#else /* ROCKBOX */
180 t_canvas *canvas=glist_getcanvas(glist); 221 t_canvas *canvas=glist_getcanvas(glist);
181 int n=x->x_number, i; 222 int n=x->x_number, i;
182 223
@@ -199,6 +240,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
199 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, 240 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x,
200 x->x_gui.x_lcol); 241 x->x_gui.x_lcol);
201 } 242 }
243#endif /* ROCKBOX */
202} 244}
203 245
204void hradio_draw(t_hradio *x, t_glist *glist, int mode) 246void hradio_draw(t_hradio *x, t_glist *glist, int mode)
@@ -254,6 +296,10 @@ static void hradio_save(t_gobj *z, t_binbuf *b)
254 296
255static void hradio_properties(t_gobj *z, t_glist *owner) 297static void hradio_properties(t_gobj *z, t_glist *owner)
256{ 298{
299#ifdef ROCKBOX
300 (void) z;
301 (void) owner;
302#else /* ROCKBOX */
257 t_hradio *x = (t_hradio *)z; 303 t_hradio *x = (t_hradio *)z;
258 char buf[800]; 304 char buf[800];
259 t_symbol *srl[3]; 305 t_symbol *srl[3];
@@ -278,6 +324,7 @@ static void hradio_properties(t_gobj *z, t_glist *owner)
278 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 324 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
279 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); 325 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
280 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); 326 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
327#endif /* ROCKBOX */
281} 328}
282 329
283static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv) 330static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv)
@@ -288,6 +335,10 @@ static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv)
288 int num = (int)atom_getintarg(6, argc, argv); 335 int num = (int)atom_getintarg(6, argc, argv);
289 int sr_flags; 336 int sr_flags;
290 337
338#ifdef ROCKBOX
339 (void) s;
340#endif
341
291 if(chg != 0) chg = 1; 342 if(chg != 0) chg = 1;
292 x->x_change = chg; 343 x->x_change = chg;
293 sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); 344 sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
@@ -462,11 +513,22 @@ static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos, t_floata
462{ 513{
463 int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); 514 int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
464 515
516#ifdef ROCKBOX
517 (void) ypos;
518 (void) shift;
519 (void) ctrl;
520 (void) alt;
521#endif
522
465 hradio_fout(x, (float)(xx / x->x_gui.x_w)); 523 hradio_fout(x, (float)(xx / x->x_gui.x_w));
466} 524}
467 525
468static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) 526static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
469{ 527{
528#ifdef ROCKBOX
529 (void) glist;
530 (void) dbl;
531#endif
470 if(doit) 532 if(doit)
471 hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); 533 hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt);
472 return (1); 534 return (1);
@@ -499,6 +561,9 @@ static void hradio_number(t_hradio *x, t_floatarg num)
499 561
500static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av) 562static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av)
501{ 563{
564#ifdef ROCKBOX
565 (void) s;
566#endif
502 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); 567 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
503 x->x_gui.x_h = x->x_gui.x_w; 568 x->x_gui.x_h = x->x_gui.x_w;
504 iemgui_size((void *)x, &x->x_gui); 569 iemgui_size((void *)x, &x->x_gui);
@@ -543,11 +608,21 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
543{ 608{
544 t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class); 609 t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class);
545 int bflcol[]={-262144, -1, -1}; 610 int bflcol[]={-262144, -1, -1};
611#ifdef ROCKBOX
612 int a=IEM_GUI_DEFAULTSIZE, on=0;
613#else
546 int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; 614 int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
615#endif
547 int ldx=0, ldy=-6, chg=1, num=8; 616 int ldx=0, ldy=-6, chg=1, num=8;
548 int fs=8; 617 int fs=8;
618#ifndef ROCKBOX
549 int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; 619 int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
550 char str[144]; 620 char str[144];
621#endif
622
623#ifdef ROCKBOX
624 (void) s;
625#endif
551 626
552 iem_inttosymargs(&x->x_gui.x_isa, 0); 627 iem_inttosymargs(&x->x_gui.x_isa, 0);
553 iem_inttofstyle(&x->x_gui.x_fsf, 0); 628 iem_inttofstyle(&x->x_gui.x_fsf, 0);
@@ -632,7 +707,9 @@ static void hradio_ff(t_hradio *x)
632{ 707{
633 if(x->x_gui.x_fsf.x_rcv_able) 708 if(x->x_gui.x_fsf.x_rcv_able)
634 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); 709 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
710#ifndef ROCKBOX
635 gfxstub_deleteforkey(x); 711 gfxstub_deleteforkey(x);
712#endif
636} 713}
637 714
638void g_hradio_setup(void) 715void g_hradio_setup(void)