diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_hslider.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_hslider.c | 86 |
1 files changed, 85 insertions, 1 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_hslider.c b/apps/plugins/pdbox/PDa/src/g_hslider.c index c5d660c5d7..4f9343cffa 100644 --- a/apps/plugins/pdbox/PDa/src/g_hslider.c +++ b/apps/plugins/pdbox/PDa/src/g_hslider.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,7 +28,7 @@ | |||
21 | #else | 28 | #else |
22 | #include <unistd.h> | 29 | #include <unistd.h> |
23 | #endif | 30 | #endif |
24 | 31 | #endif /* ROCKBOX */ | |
25 | 32 | ||
26 | /* ------------ hsl gui-horicontal slider ----------------------- */ | 33 | /* ------------ hsl gui-horicontal slider ----------------------- */ |
27 | 34 | ||
@@ -32,6 +39,10 @@ static t_class *hslider_class; | |||
32 | 39 | ||
33 | static void hslider_draw_update(t_hslider *x, t_glist *glist) | 40 | static void hslider_draw_update(t_hslider *x, t_glist *glist) |
34 | { | 41 | { |
42 | #ifdef ROCKBOX | ||
43 | (void) x; | ||
44 | (void) glist; | ||
45 | #else /* ROCKBOX */ | ||
35 | t_canvas *canvas=glist_getcanvas(glist); | 46 | t_canvas *canvas=glist_getcanvas(glist); |
36 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 47 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
37 | 48 | ||
@@ -58,10 +69,15 @@ static void hslider_draw_update(t_hslider *x, t_glist *glist) | |||
58 | } | 69 | } |
59 | } | 70 | } |
60 | } | 71 | } |
72 | #endif /* ROCKBOX */ | ||
61 | } | 73 | } |
62 | 74 | ||
63 | static void hslider_draw_new(t_hslider *x, t_glist *glist) | 75 | static void hslider_draw_new(t_hslider *x, t_glist *glist) |
64 | { | 76 | { |
77 | #ifdef ROCKBOX | ||
78 | (void) x; | ||
79 | (void) glist; | ||
80 | #else /* ROCKBOX */ | ||
65 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 81 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
66 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 82 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
67 | int r = xpos + (x->x_val + 50)/100; | 83 | int r = xpos + (x->x_val + 50)/100; |
@@ -88,10 +104,15 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist) | |||
88 | sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", | 104 | sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", |
89 | canvas, xpos-3, ypos, | 105 | canvas, xpos-3, ypos, |
90 | xpos+4, ypos+1, x, 0); | 106 | xpos+4, ypos+1, x, 0); |
107 | #endif /* ROCKBOX */ | ||
91 | } | 108 | } |
92 | 109 | ||
93 | static void hslider_draw_move(t_hslider *x, t_glist *glist) | 110 | static void hslider_draw_move(t_hslider *x, t_glist *glist) |
94 | { | 111 | { |
112 | #ifdef ROCKBOX | ||
113 | (void) x; | ||
114 | (void) glist; | ||
115 | #else /* ROCKBOX */ | ||
95 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 116 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
96 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 117 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
97 | int r = xpos + (x->x_val + 50)/100; | 118 | int r = xpos + (x->x_val + 50)/100; |
@@ -116,10 +137,15 @@ static void hslider_draw_move(t_hslider *x, t_glist *glist) | |||
116 | canvas, x, 0, | 137 | canvas, x, 0, |
117 | xpos-3, ypos, | 138 | xpos-3, ypos, |
118 | xpos+4, ypos+1); | 139 | xpos+4, ypos+1); |
140 | #endif /* ROCKBOX */ | ||
119 | } | 141 | } |
120 | 142 | ||
121 | static void hslider_draw_erase(t_hslider* x,t_glist* glist) | 143 | static void hslider_draw_erase(t_hslider* x,t_glist* glist) |
122 | { | 144 | { |
145 | #ifdef ROCKBOX | ||
146 | (void) x; | ||
147 | (void) glist; | ||
148 | #else /* ROCKBOX */ | ||
123 | t_canvas *canvas=glist_getcanvas(glist); | 149 | t_canvas *canvas=glist_getcanvas(glist); |
124 | 150 | ||
125 | sys_vgui(".x%x.c delete %xBASE\n", canvas, x); | 151 | sys_vgui(".x%x.c delete %xBASE\n", canvas, x); |
@@ -129,10 +155,15 @@ static void hslider_draw_erase(t_hslider* x,t_glist* glist) | |||
129 | sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); | 155 | sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); |
130 | if(!x->x_gui.x_fsf.x_rcv_able) | 156 | if(!x->x_gui.x_fsf.x_rcv_able) |
131 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 157 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
158 | #endif /* ROCKBOX */ | ||
132 | } | 159 | } |
133 | 160 | ||
134 | static void hslider_draw_config(t_hslider* x,t_glist* glist) | 161 | static void hslider_draw_config(t_hslider* x,t_glist* glist) |
135 | { | 162 | { |
163 | #ifdef ROCKBOX | ||
164 | (void) x; | ||
165 | (void) glist; | ||
166 | #else /* ROCKBOX */ | ||
136 | t_canvas *canvas=glist_getcanvas(glist); | 167 | t_canvas *canvas=glist_getcanvas(glist); |
137 | 168 | ||
138 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", | 169 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", |
@@ -141,10 +172,16 @@ static void hslider_draw_config(t_hslider* x,t_glist* glist) | |||
141 | strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); | 172 | strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); |
142 | sys_vgui(".x%x.c itemconfigure %xKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); | 173 | sys_vgui(".x%x.c itemconfigure %xKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); |
143 | sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); | 174 | sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); |
175 | #endif /* ROCKBOX */ | ||
144 | } | 176 | } |
145 | 177 | ||
146 | static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) | 178 | static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) |
147 | { | 179 | { |
180 | #ifdef ROCKBOX | ||
181 | (void) x; | ||
182 | (void) glist; | ||
183 | (void) old_snd_rcv_flags; | ||
184 | #else /* ROCKBOX */ | ||
148 | int xpos=text_xpix(&x->x_gui.x_obj, glist); | 185 | int xpos=text_xpix(&x->x_gui.x_obj, glist); |
149 | int ypos=text_ypix(&x->x_gui.x_obj, glist); | 186 | int ypos=text_ypix(&x->x_gui.x_obj, glist); |
150 | t_canvas *canvas=glist_getcanvas(glist); | 187 | t_canvas *canvas=glist_getcanvas(glist); |
@@ -161,10 +198,15 @@ static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) | |||
161 | xpos+4, ypos+1, x, 0); | 198 | xpos+4, ypos+1, x, 0); |
162 | if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) | 199 | if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) |
163 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); | 200 | sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); |
201 | #endif /* ROCKBOX */ | ||
164 | } | 202 | } |
165 | 203 | ||
166 | static void hslider_draw_select(t_hslider* x,t_glist* glist) | 204 | static void hslider_draw_select(t_hslider* x,t_glist* glist) |
167 | { | 205 | { |
206 | #ifdef ROCKBOX | ||
207 | (void) x; | ||
208 | (void) glist; | ||
209 | #else /* ROCKBOX */ | ||
168 | t_canvas *canvas=glist_getcanvas(glist); | 210 | t_canvas *canvas=glist_getcanvas(glist); |
169 | 211 | ||
170 | if(x->x_gui.x_fsf.x_selected) | 212 | if(x->x_gui.x_fsf.x_selected) |
@@ -177,6 +219,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist) | |||
177 | sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); | 219 | sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); |
178 | sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); | 220 | sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); |
179 | } | 221 | } |
222 | #endif /* ROCKBOX */ | ||
180 | } | 223 | } |
181 | 224 | ||
182 | void hslider_draw(t_hslider *x, t_glist *glist, int mode) | 225 | void hslider_draw(t_hslider *x, t_glist *glist, int mode) |
@@ -279,6 +322,10 @@ void hslider_check_minmax(t_hslider *x, double min, double max) | |||
279 | 322 | ||
280 | static void hslider_properties(t_gobj *z, t_glist *owner) | 323 | static void hslider_properties(t_gobj *z, t_glist *owner) |
281 | { | 324 | { |
325 | #ifdef ROCKBOX | ||
326 | (void) z; | ||
327 | (void) owner; | ||
328 | #else /* ROCKBOX */ | ||
282 | t_hslider *x = (t_hslider *)z; | 329 | t_hslider *x = (t_hslider *)z; |
283 | char buf[800]; | 330 | char buf[800]; |
284 | t_symbol *srl[3]; | 331 | t_symbol *srl[3]; |
@@ -300,6 +347,7 @@ static void hslider_properties(t_gobj *z, t_glist *owner) | |||
300 | x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, | 347 | x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, |
301 | 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); | 348 | 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); |
302 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); | 349 | gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); |
350 | #endif /* ROCKBOX */ | ||
303 | } | 351 | } |
304 | 352 | ||
305 | static void hslider_set(t_hslider *x, t_floatarg f) /* bugfix */ | 353 | static void hslider_set(t_hslider *x, t_floatarg f) /* bugfix */ |
@@ -355,6 +403,10 @@ static void hslider_dialog(t_hslider *x, t_symbol *s, int argc, t_atom *argv) | |||
355 | int steady = (int)atom_getintarg(17, argc, argv); | 403 | int steady = (int)atom_getintarg(17, argc, argv); |
356 | int sr_flags; | 404 | int sr_flags; |
357 | 405 | ||
406 | #ifdef ROCKBOX | ||
407 | (void) s; | ||
408 | #endif | ||
409 | |||
358 | if(lilo != 0) lilo = 1; | 410 | if(lilo != 0) lilo = 1; |
359 | x->x_lin0_log1 = lilo; | 411 | x->x_lin0_log1 = lilo; |
360 | if(steady) | 412 | if(steady) |
@@ -375,6 +427,10 @@ static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy) | |||
375 | { | 427 | { |
376 | int old = x->x_val; | 428 | int old = x->x_val; |
377 | 429 | ||
430 | #ifdef ROCKBOX | ||
431 | (void) dy; | ||
432 | #endif | ||
433 | |||
378 | if(x->x_gui.x_fsf.x_finemoved) | 434 | if(x->x_gui.x_fsf.x_finemoved) |
379 | x->x_pos += (int)dx; | 435 | x->x_pos += (int)dx; |
380 | else | 436 | else |
@@ -402,6 +458,11 @@ static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy) | |||
402 | static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos, | 458 | static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos, |
403 | t_floatarg shift, t_floatarg ctrl, t_floatarg alt) | 459 | t_floatarg shift, t_floatarg ctrl, t_floatarg alt) |
404 | { | 460 | { |
461 | #ifdef ROCKBOX | ||
462 | (void) shift; | ||
463 | (void) ctrl; | ||
464 | (void) alt; | ||
465 | #endif | ||
405 | if(!x->x_steady) | 466 | if(!x->x_steady) |
406 | x->x_val = (int)(100.0 * (xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))); | 467 | x->x_val = (int)(100.0 * (xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))); |
407 | if(x->x_val > (100*x->x_gui.x_w - 100)) | 468 | if(x->x_val > (100*x->x_gui.x_w - 100)) |
@@ -420,6 +481,11 @@ static int hslider_newclick(t_gobj *z, struct _glist *glist, | |||
420 | { | 481 | { |
421 | t_hslider* x = (t_hslider *)z; | 482 | t_hslider* x = (t_hslider *)z; |
422 | 483 | ||
484 | #ifdef ROCKBOX | ||
485 | (void) glist; | ||
486 | (void) dbl; | ||
487 | #endif | ||
488 | |||
423 | if(doit) | 489 | if(doit) |
424 | { | 490 | { |
425 | hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, | 491 | hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, |
@@ -434,6 +500,9 @@ static int hslider_newclick(t_gobj *z, struct _glist *glist, | |||
434 | 500 | ||
435 | static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av) | 501 | static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av) |
436 | { | 502 | { |
503 | #ifdef ROCKBOX | ||
504 | (void) s; | ||
505 | #endif | ||
437 | hslider_check_width(x, (int)atom_getintarg(0, ac, av)); | 506 | hslider_check_width(x, (int)atom_getintarg(0, ac, av)); |
438 | if(ac > 1) | 507 | if(ac > 1) |
439 | x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av)); | 508 | x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av)); |
@@ -448,6 +517,9 @@ static void hslider_pos(t_hslider *x, t_symbol *s, int ac, t_atom *av) | |||
448 | 517 | ||
449 | static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av) | 518 | static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av) |
450 | { | 519 | { |
520 | #ifdef ROCKBOX | ||
521 | (void) s; | ||
522 | #endif | ||
451 | hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), | 523 | hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), |
452 | (double)atom_getfloatarg(1, ac, av)); | 524 | (double)atom_getfloatarg(1, ac, av)); |
453 | } | 525 | } |
@@ -525,10 +597,20 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv) | |||
525 | t_hslider *x = (t_hslider *)pd_new(hslider_class); | 597 | t_hslider *x = (t_hslider *)pd_new(hslider_class); |
526 | int bflcol[]={-262144, -1, -1}; | 598 | int bflcol[]={-262144, -1, -1}; |
527 | int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE; | 599 | int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE; |
600 | #ifdef ROCKBOX | ||
601 | int lilo=0, ldx=-2, ldy=-6, v=0, steady=1; | ||
602 | #else | ||
528 | int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1; | 603 | int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1; |
604 | #endif | ||
529 | int fs=8; | 605 | int fs=8; |
530 | double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); | 606 | double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); |
607 | #ifndef ROCKBOX | ||
531 | char str[144]; | 608 | char str[144]; |
609 | #endif | ||
610 | |||
611 | #ifdef ROCKBOX | ||
612 | (void) s; | ||
613 | #endif | ||
532 | 614 | ||
533 | iem_inttosymargs(&x->x_gui.x_isa, 0); | 615 | iem_inttosymargs(&x->x_gui.x_isa, 0); |
534 | iem_inttofstyle(&x->x_gui.x_fsf, 0); | 616 | iem_inttofstyle(&x->x_gui.x_fsf, 0); |
@@ -607,7 +689,9 @@ static void hslider_free(t_hslider *x) | |||
607 | { | 689 | { |
608 | if(x->x_gui.x_fsf.x_rcv_able) | 690 | if(x->x_gui.x_fsf.x_rcv_able) |
609 | pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); | 691 | pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); |
692 | #ifndef ROCKBOX | ||
610 | gfxstub_deleteforkey(x); | 693 | gfxstub_deleteforkey(x); |
694 | #endif | ||
611 | } | 695 | } |
612 | 696 | ||
613 | void g_hslider_setup(void) | 697 | void g_hslider_setup(void) |