summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/g_vslider.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_vslider.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/g_vslider.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_vslider.c b/apps/plugins/pdbox/PDa/src/g_vslider.c
index ee02236769..f01dcfdf6d 100644
--- a/apps/plugins/pdbox/PDa/src/g_vslider.c
+++ b/apps/plugins/pdbox/PDa/src/g_vslider.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 33
26/* ------------ vsl gui-vertical slider ----------------------- */ 34/* ------------ vsl gui-vertical slider ----------------------- */
@@ -32,6 +40,10 @@ static t_class *vslider_class;
32 40
33static void vslider_draw_update(t_vslider *x, t_glist *glist) 41static void vslider_draw_update(t_vslider *x, t_glist *glist)
34{ 42{
43#ifdef ROCKBOX
44 (void) x;
45 (void) glist;
46#else /* ROCKBOX */
35 if (glist_isvisible(glist)) 47 if (glist_isvisible(glist))
36 { 48 {
37 int r = text_ypix(&x->x_gui.x_obj, glist) + x->x_gui.x_h - (x->x_val + 50)/100; 49 int r = text_ypix(&x->x_gui.x_obj, glist) + x->x_gui.x_h - (x->x_val + 50)/100;
@@ -41,10 +53,15 @@ static void vslider_draw_update(t_vslider *x, t_glist *glist)
41 glist_getcanvas(glist), x, xpos+1, r, 53 glist_getcanvas(glist), x, xpos+1, r,
42 xpos + x->x_gui.x_w, r); 54 xpos + x->x_gui.x_w, r);
43 } 55 }
56#endif /* ROCKBOX */
44} 57}
45 58
46static void vslider_draw_new(t_vslider *x, t_glist *glist) 59static void vslider_draw_new(t_vslider *x, t_glist *glist)
47{ 60{
61#ifdef ROCKBOX
62 (void) x;
63 (void) glist;
64#else /* ROCKBOX */
48 int xpos=text_xpix(&x->x_gui.x_obj, glist); 65 int xpos=text_xpix(&x->x_gui.x_obj, glist);
49 int ypos=text_ypix(&x->x_gui.x_obj, glist); 66 int ypos=text_ypix(&x->x_gui.x_obj, glist);
50 int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; 67 int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100;
@@ -74,10 +91,15 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist)
74 xpos, ypos-2, 91 xpos, ypos-2,
75 xpos+7, ypos-1, 92 xpos+7, ypos-1,
76 x, 0); 93 x, 0);
94#endif /* ROCKBOX */
77} 95}
78 96
79static void vslider_draw_move(t_vslider *x, t_glist *glist) 97static void vslider_draw_move(t_vslider *x, t_glist *glist)
80{ 98{
99#ifdef ROCKBOX
100 (void) x;
101 (void) glist;
102#else /* ROCKBOX */
81 int xpos=text_xpix(&x->x_gui.x_obj, glist); 103 int xpos=text_xpix(&x->x_gui.x_obj, glist);
82 int ypos=text_ypix(&x->x_gui.x_obj, glist); 104 int ypos=text_ypix(&x->x_gui.x_obj, glist);
83 int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; 105 int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100;
@@ -102,10 +124,15 @@ static void vslider_draw_move(t_vslider *x, t_glist *glist)
102 canvas, x, 0, 124 canvas, x, 0,
103 xpos, ypos-2, 125 xpos, ypos-2,
104 xpos+7, ypos-1); 126 xpos+7, ypos-1);
127#endif /* ROCKBOX */
105} 128}
106 129
107static void vslider_draw_erase(t_vslider* x,t_glist* glist) 130static void vslider_draw_erase(t_vslider* x,t_glist* glist)
108{ 131{
132#ifdef ROCKBOX
133 (void) x;
134 (void) glist;
135#else /* ROCKBOX */
109 t_canvas *canvas=glist_getcanvas(glist); 136 t_canvas *canvas=glist_getcanvas(glist);
110 137
111 sys_vgui(".x%x.c delete %xBASE\n", canvas, x); 138 sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
@@ -115,10 +142,15 @@ static void vslider_draw_erase(t_vslider* x,t_glist* glist)
115 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); 142 sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0);
116 if(!x->x_gui.x_fsf.x_rcv_able) 143 if(!x->x_gui.x_fsf.x_rcv_able)
117 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 144 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
145#endif /* ROCKBOX */
118} 146}
119 147
120static void vslider_draw_config(t_vslider* x,t_glist* glist) 148static void vslider_draw_config(t_vslider* x,t_glist* glist)
121{ 149{
150#ifdef ROCKBOX
151 (void) x;
152 (void) glist;
153#else /* ROCKBOX */
122 t_canvas *canvas=glist_getcanvas(glist); 154 t_canvas *canvas=glist_getcanvas(glist);
123 155
124 sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", 156 sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
@@ -129,10 +161,16 @@ static void vslider_draw_config(t_vslider* x,t_glist* glist)
129 x, x->x_gui.x_fcol); 161 x, x->x_gui.x_fcol);
130 sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, 162 sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas,
131 x, x->x_gui.x_bcol); 163 x, x->x_gui.x_bcol);
164#endif /* ROCKBOX */
132} 165}
133 166
134static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags) 167static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags)
135{ 168{
169#ifdef ROCKBOX
170 (void) x;
171 (void) glist;
172 (void) old_snd_rcv_flags;
173#else /* ROCKBOX */
136 int xpos=text_xpix(&x->x_gui.x_obj, glist); 174 int xpos=text_xpix(&x->x_gui.x_obj, glist);
137 int ypos=text_ypix(&x->x_gui.x_obj, glist); 175 int ypos=text_ypix(&x->x_gui.x_obj, glist);
138 t_canvas *canvas=glist_getcanvas(glist); 176 t_canvas *canvas=glist_getcanvas(glist);
@@ -153,10 +191,15 @@ static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags)
153 x, 0); 191 x, 0);
154 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) 192 if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
155 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); 193 sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0);
194#endif /* ROCKBOX */
156} 195}
157 196
158static void vslider_draw_select(t_vslider *x, t_glist *glist) 197static void vslider_draw_select(t_vslider *x, t_glist *glist)
159{ 198{
199#ifdef ROCKBOX
200 (void) x;
201 (void) glist;
202#else /* ROCKBOX */
160 t_canvas *canvas=glist_getcanvas(glist); 203 t_canvas *canvas=glist_getcanvas(glist);
161 204
162 if(x->x_gui.x_fsf.x_selected) 205 if(x->x_gui.x_fsf.x_selected)
@@ -169,6 +212,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist)
169 sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); 212 sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL);
170 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); 213 sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol);
171 } 214 }
215#endif /* ROCKBOX */
172} 216}
173 217
174void vslider_draw(t_vslider *x, t_glist *glist, int mode) 218void vslider_draw(t_vslider *x, t_glist *glist, int mode)
@@ -270,6 +314,10 @@ void vslider_check_minmax(t_vslider *x, double min, double max)
270 314
271static void vslider_properties(t_gobj *z, t_glist *owner) 315static void vslider_properties(t_gobj *z, t_glist *owner)
272{ 316{
317#ifdef ROCKBOX
318 (void) z;
319 (void) owner;
320#else /* ROCKBOX */
273 t_vslider *x = (t_vslider *)z; 321 t_vslider *x = (t_vslider *)z;
274 char buf[800]; 322 char buf[800];
275 t_symbol *srl[3]; 323 t_symbol *srl[3];
@@ -292,6 +340,7 @@ static void vslider_properties(t_gobj *z, t_glist *owner)
292 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 340 x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
293 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); 341 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol);
294 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); 342 gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
343#endif
295} 344}
296 345
297static void vslider_bang(t_vslider *x) 346static void vslider_bang(t_vslider *x)
@@ -321,6 +370,10 @@ static void vslider_dialog(t_vslider *x, t_symbol *s, int argc, t_atom *argv)
321 int steady = (int)atom_getintarg(17, argc, argv); 370 int steady = (int)atom_getintarg(17, argc, argv);
322 int sr_flags; 371 int sr_flags;
323 372
373#ifdef ROCKBOX
374 (void) s;
375#endif
376
324 if(lilo != 0) lilo = 1; 377 if(lilo != 0) lilo = 1;
325 x->x_lin0_log1 = lilo; 378 x->x_lin0_log1 = lilo;
326 if(steady) 379 if(steady)
@@ -341,6 +394,10 @@ static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy)
341{ 394{
342 int old = x->x_val; 395 int old = x->x_val;
343 396
397#ifdef ROCKBOX
398 (void) dx;
399#endif
400
344 if(x->x_gui.x_fsf.x_finemoved) 401 if(x->x_gui.x_fsf.x_finemoved)
345 x->x_pos -= (int)dy; 402 x->x_pos -= (int)dy;
346 else 403 else
@@ -368,6 +425,11 @@ static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy)
368static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos, 425static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos,
369 t_floatarg shift, t_floatarg ctrl, t_floatarg alt) 426 t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
370{ 427{
428#ifdef ROCKBOX
429 (void) shift;
430 (void) ctrl;
431 (void) alt;
432#endif
371 if(!x->x_steady) 433 if(!x->x_steady)
372 x->x_val = (int)(100.0 * (x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos)); 434 x->x_val = (int)(100.0 * (x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos));
373 if(x->x_val > (100*x->x_gui.x_h - 100)) 435 if(x->x_val > (100*x->x_gui.x_h - 100))
@@ -386,6 +448,11 @@ static int vslider_newclick(t_gobj *z, struct _glist *glist,
386{ 448{
387 t_vslider* x = (t_vslider *)z; 449 t_vslider* x = (t_vslider *)z;
388 450
451#ifdef ROCKBOX
452 (void) glist;
453 (void) dbl;
454#endif
455
389 if(doit) 456 if(doit)
390 { 457 {
391 vslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 458 vslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift,
@@ -434,6 +501,9 @@ static void vslider_float(t_vslider *x, t_floatarg f)
434 501
435static void vslider_size(t_vslider *x, t_symbol *s, int ac, t_atom *av) 502static void vslider_size(t_vslider *x, t_symbol *s, int ac, t_atom *av)
436{ 503{
504#ifdef ROCKBOX
505 (void) s;
506#endif
437 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); 507 x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av));
438 if(ac > 1) 508 if(ac > 1)
439 vslider_check_height(x, (int)atom_getintarg(1, ac, av)); 509 vslider_check_height(x, (int)atom_getintarg(1, ac, av));
@@ -448,6 +518,9 @@ static void vslider_pos(t_vslider *x, t_symbol *s, int ac, t_atom *av)
448 518
449static void vslider_range(t_vslider *x, t_symbol *s, int ac, t_atom *av) 519static void vslider_range(t_vslider *x, t_symbol *s, int ac, t_atom *av)
450{ 520{
521#ifdef ROCKBOX
522 (void) s;
523#endif
451 vslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), 524 vslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av),
452 (double)atom_getfloatarg(1, ac, av)); 525 (double)atom_getfloatarg(1, ac, av));
453} 526}
@@ -506,10 +579,20 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
506 t_vslider *x = (t_vslider *)pd_new(vslider_class); 579 t_vslider *x = (t_vslider *)pd_new(vslider_class);
507 int bflcol[]={-262144, -1, -1}; 580 int bflcol[]={-262144, -1, -1};
508 int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE; 581 int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
582#ifdef ROCKBOX
583 int lilo=0, ldx=0, ldy=-8;
584#else
509 int lilo=0, f=0, ldx=0, ldy=-8; 585 int lilo=0, f=0, ldx=0, ldy=-8;
586#endif
510 int fs=8, v=0, steady=1; 587 int fs=8, v=0, steady=1;
511 double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); 588 double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
589#ifndef ROCKBOX
512 char str[144]; 590 char str[144];
591#endif
592
593#ifdef ROCKBOX
594 (void) s;
595#endif
513 596
514 iem_inttosymargs(&x->x_gui.x_isa, 0); 597 iem_inttosymargs(&x->x_gui.x_isa, 0);
515 iem_inttofstyle(&x->x_gui.x_fsf, 0); 598 iem_inttofstyle(&x->x_gui.x_fsf, 0);
@@ -581,7 +664,9 @@ static void vslider_free(t_vslider *x)
581{ 664{
582 if(x->x_gui.x_fsf.x_rcv_able) 665 if(x->x_gui.x_fsf.x_rcv_able)
583 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); 666 pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
667#ifndef ROCKBOX
584 gfxstub_deleteforkey(x); 668 gfxstub_deleteforkey(x);
669#endif
585} 670}
586 671
587void g_vslider_setup(void) 672void g_vslider_setup(void)