summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/g_vdial.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
commit0d4560cb0305029fa5f0739670286176ab47cb65 (patch)
tree9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/g_vdial.c
parenteabeb928ddfdbe5fc6379efb87d9522803310649 (diff)
downloadrockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz
rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_vdial.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/g_vdial.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_vdial.c b/apps/plugins/pdbox/PDa/src/g_vdial.c
index 47ac3d19bb..bf026c697f 100644
--- a/apps/plugins/pdbox/PDa/src/g_vdial.c
+++ b/apps/plugins/pdbox/PDa/src/g_vdial.c
@@ -7,6 +7,13 @@
7/* name change to vradio by MSP (it's a radio button really) and changed to 7/* name change to vradio by MSP (it's a radio button really) and changed to
8put out a "float" as in sliders, toggles, etc. */ 8put out a "float" as in sliders, toggles, etc. */
9 9
10#ifdef ROCKBOX
11#include "plugin.h"
12#include "pdbox.h"
13#include "m_pd.h"
14#include "g_canvas.h"
15#include "g_all_guis.h"
16#else /* ROCKBOX */
10#include <stdlib.h> 17#include <stdlib.h>
11#include <string.h> 18#include <string.h>
12#include <stdio.h> 19#include <stdio.h>
@@ -16,6 +23,7 @@ put out a "float" as in sliders, toggles, etc. */
16#include "t_tk.h" 23#include "t_tk.h"
17#include "g_all_guis.h" 24#include "g_all_guis.h"
18#include <math.h> 25#include <math.h>
26#endif /* ROCKBOX */
19 27
20/*------------------ global variables -------------------------*/ 28/*------------------ global variables -------------------------*/
21 29
@@ -34,6 +42,10 @@ static t_class *vradio_class, *vradio_old_class;
34 42
35void vradio_draw_update(t_vradio *x, t_glist *glist) 43void vradio_draw_update(t_vradio *x, t_glist *glist)
36{ 44{
45#ifdef ROCKBOX
46 (void) x;
47 (void) glist;
48#else /* ROCKBOX */
37 if(glist_isvisible(glist)) 49 if(glist_isvisible(glist))
38 { 50 {
39 t_canvas *canvas=glist_getcanvas(glist); 51 t_canvas *canvas=glist_getcanvas(glist);
@@ -45,10 +57,15 @@ void vradio_draw_update(t_vradio *x, t_glist *glist)
45 canvas, x, x->x_on, 57 canvas, x, x->x_on,
46 x->x_gui.x_fcol, x->x_gui.x_fcol); 58 x->x_gui.x_fcol, x->x_gui.x_fcol);
47 } 59 }
60#endif /* ROCKBOX */
48} 61}
49 62
50void vradio_draw_new(t_vradio *x, t_glist *glist) 63void vradio_draw_new(t_vradio *x, t_glist *glist)
51{ 64{
65#ifdef ROCKBOX
66 (void) x;
67 (void) glist;
68#else /* ROCKBOX */
52 t_canvas *canvas=glist_getcanvas(glist); 69 t_canvas *canvas=glist_getcanvas(glist);
53 int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; 70 int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4;
54 int yy11b=text_ypix(&x->x_gui.x_obj, glist); 71 int yy11b=text_ypix(&x->x_gui.x_obj, glist);
@@ -83,10 +100,15 @@ void vradio_draw_new(t_vradio *x, t_glist *glist)
83 if(!x->x_gui.x_fsf.x_rcv_able) 100 if(!x->x_gui.x_fsf.x_rcv_able)
84 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", 101 sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n",
85 canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, 0); 102 canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, 0);
103#endif /* ROCKBOX */
86} 104}
87 105
88void vradio_draw_move(t_vradio *x, t_glist *glist) 106void vradio_draw_move(t_vradio *x, t_glist *glist)
89{ 107{
108#ifdef ROCKBOX
109 (void) x;
110 (void) glist;
111#else /* ROCKBOX */
90 t_canvas *canvas=glist_getcanvas(glist); 112 t_canvas *canvas=glist_getcanvas(glist);
91 int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; 113 int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4;
92 int yy11b=text_ypix(&x->x_gui.x_obj, glist); 114 int yy11b=text_ypix(&x->x_gui.x_obj, glist);
@@ -114,10 +136,15 @@ void vradio_draw_move(t_vradio *x, t_glist *glist)
114 if(!x->x_gui.x_fsf.x_rcv_able) 136 if(!x->x_gui.x_fsf.x_rcv_able)
115 sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", 137 sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n",
116 canvas, x, 0, xx11, yy11b, xx11 + IOWIDTH, yy11b+1); 138 canvas, x, 0, xx11, yy11b, xx11 + IOWIDTH, yy11b+1);
139#endif /* ROCKBOX */
117} 140}
118 141
119void vradio_draw_erase(t_vradio* x, t_glist* glist) 142void vradio_draw_erase(t_vradio* x, t_glist* glist)
120{ 143{
144#ifdef ROCKBOX
145 (void) x;
146 (void) glist;
147#else /* ROCKBOX */
121 t_canvas *canvas=glist_getcanvas(glist); 148 t_canvas *canvas=glist_getcanvas(glist);
122 int n=x->x_number, i; 149 int n=x->x_number, i;
123 150
@@ -131,10 +158,15 @@ void vradio_draw_erase(t_vradio* x, t_glist* glist)
131 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); 158 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
132 if(!x->x_gui.x_fsf.x_rcv_able) 159 if(!x->x_gui.x_fsf.x_rcv_able)
133 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 160 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
161#endif /* ROCKBOX */
134} 162}
135 163
136void vradio_draw_config(t_vradio* x, t_glist* glist) 164void vradio_draw_config(t_vradio* x, t_glist* glist)
137{ 165{
166#ifdef ROCKBOX
167 (void) x;
168 (void) glist;
169#else /* ROCKBOX */
138 t_canvas *canvas=glist_getcanvas(glist); 170 t_canvas *canvas=glist_getcanvas(glist);
139 int n=x->x_number, i; 171 int n=x->x_number, i;
140 172
@@ -150,10 +182,16 @@ void vradio_draw_config(t_vradio* x, t_glist* glist)
150 (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, 182 (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); 183 (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol);
152 } 184 }
185#endif /* ROCKBOX */
153} 186}
154 187
155void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) 188void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags)
156{ 189{
190#ifdef ROCKBOX
191 (void) x;
192 (void) glist;
193 (void) old_snd_rcv_flags;
194#else /* ROCKBOX */
157 t_canvas *canvas=glist_getcanvas(glist); 195 t_canvas *canvas=glist_getcanvas(glist);
158 int xpos=text_xpix(&x->x_gui.x_obj, glist); 196 int xpos=text_xpix(&x->x_gui.x_obj, glist);
159 int ypos=text_ypix(&x->x_gui.x_obj, glist); 197 int ypos=text_ypix(&x->x_gui.x_obj, glist);
@@ -173,10 +211,15 @@ void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags)
173 x, 0); 211 x, 0);
174 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) 212 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); 213 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
214#endif /* ROCKBOX */
176} 215}
177 216
178void vradio_draw_select(t_vradio* x, t_glist* glist) 217void vradio_draw_select(t_vradio* x, t_glist* glist)
179{ 218{
219#ifdef ROCKBOX
220 (void) x;
221 (void) glist;
222#else /* ROCKBOX */
180 t_canvas *canvas=glist_getcanvas(glist); 223 t_canvas *canvas=glist_getcanvas(glist);
181 int n=x->x_number, i; 224 int n=x->x_number, i;
182 225
@@ -199,6 +242,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist)
199 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, 242 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x,
200 x->x_gui.x_lcol); 243 x->x_gui.x_lcol);
201 } 244 }
245#endif /* ROCKBOX */
202} 246}
203 247
204void vradio_draw(t_vradio *x, t_glist *glist, int mode) 248void vradio_draw(t_vradio *x, t_glist *glist, int mode)
@@ -254,6 +298,10 @@ static void vradio_save(t_gobj *z, t_binbuf *b)
254 298
255static void vradio_properties(t_gobj *z, t_glist *owner) 299static void vradio_properties(t_gobj *z, t_glist *owner)
256{ 300{
301#ifdef ROCKBOX
302 (void) z;
303 (void) owner;
304#else /* ROCKBOX */
257 t_vradio *x = (t_vradio *)z; 305 t_vradio *x = (t_vradio *)z;
258 char buf[800]; 306 char buf[800];
259 t_symbol *srl[3]; 307 t_symbol *srl[3];
@@ -278,6 +326,7 @@ static void vradio_properties(t_gobj *z, t_glist *owner)
278 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 326 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); 327 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); 328 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
329#endif /* ROCKBOX */
281} 330}
282 331
283static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv) 332static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv)
@@ -288,6 +337,10 @@ static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv)
288 int num = (int)atom_getintarg(6, argc, argv); 337 int num = (int)atom_getintarg(6, argc, argv);
289 int sr_flags; 338 int sr_flags;
290 339
340#ifdef ROCKBOX
341 (void) s;
342#endif
343
291 if(chg != 0) chg = 1; 344 if(chg != 0) chg = 1;
292 x->x_change = chg; 345 x->x_change = chg;
293 sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); 346 sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv);
@@ -463,12 +516,23 @@ static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos,
463{ 516{
464 int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); 517 int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
465 518
519#ifdef ROCKBOX
520 (void) xpos;
521 (void) shift;
522 (void) ctrl;
523 (void) alt;
524#endif
525
466 vradio_fout(x, (float)(yy / x->x_gui.x_h)); 526 vradio_fout(x, (float)(yy / x->x_gui.x_h));
467} 527}
468 528
469static int vradio_newclick(t_gobj *z, struct _glist *glist, 529static int vradio_newclick(t_gobj *z, struct _glist *glist,
470 int xpix, int ypix, int shift, int alt, int dbl, int doit) 530 int xpix, int ypix, int shift, int alt, int dbl, int doit)
471{ 531{
532#ifdef ROCKBOX
533 (void) glist;
534 (void) dbl;
535#endif
472 if(doit) 536 if(doit)
473 vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, 537 vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix,
474 (t_floatarg)shift, 0, (t_floatarg)alt); 538 (t_floatarg)shift, 0, (t_floatarg)alt);
@@ -502,6 +566,9 @@ static void vradio_number(t_vradio *x, t_floatarg num)
502 566
503static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av) 567static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av)
504{ 568{
569#ifdef ROCKBOX
570 (void) s;
571#endif
505 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); 572 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
506 x->x_gui.x_h = x->x_gui.x_w; 573 x->x_gui.x_h = x->x_gui.x_w;
507 iemgui_size((void *)x, &x->x_gui); 574 iemgui_size((void *)x, &x->x_gui);
@@ -546,11 +613,21 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
546{ 613{
547 t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class); 614 t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class);
548 int bflcol[]={-262144, -1, -1}; 615 int bflcol[]={-262144, -1, -1};
616#ifdef ROCKBOX
617 int a=IEM_GUI_DEFAULTSIZE, on=0;
618#else
549 int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; 619 int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
620#endif
550 int ldx=0, ldy=-6, chg=1, num=8; 621 int ldx=0, ldy=-6, chg=1, num=8;
551 int fs=8; 622 int fs=8;
623#ifndef ROCKBOX
552 int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; 624 int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
553 char str[144]; 625 char str[144];
626#endif
627
628#ifdef ROCKBOX
629 (void) s;
630#endif
554 631
555 if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2) 632 if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
556 &&IS_A_FLOAT(argv,3) 633 &&IS_A_FLOAT(argv,3)
@@ -632,7 +709,9 @@ static void vradio_ff(t_vradio *x)
632{ 709{
633 if(x->x_gui.x_fsf.x_rcv_able) 710 if(x->x_gui.x_fsf.x_rcv_able)
634 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); 711 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
712#ifndef ROCKBOX
635 gfxstub_deleteforkey(x); 713 gfxstub_deleteforkey(x);
714#endif
636} 715}
637 716
638void g_vradio_setup(void) 717void g_vradio_setup(void)