diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
commit | 513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch) | |
tree | 10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/PDa/extra/sliderh.c | |
parent | 95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff) | |
download | rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip |
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/sliderh.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/extra/sliderh.c | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/sliderh.c b/apps/plugins/pdbox/PDa/extra/sliderh.c new file mode 100644 index 0000000000..23a6d256e0 --- /dev/null +++ b/apps/plugins/pdbox/PDa/extra/sliderh.c | |||
@@ -0,0 +1,126 @@ | |||
1 | #include "m_pd.h" | ||
2 | #include "g_canvas.h" | ||
3 | |||
4 | |||
5 | #ifdef NT | ||
6 | #pragma warning( disable : 4244 ) | ||
7 | #pragma warning( disable : 4305 ) | ||
8 | #endif | ||
9 | |||
10 | #include "fatom.h" | ||
11 | |||
12 | /* can we use the normal text save function ?? */ | ||
13 | |||
14 | static t_class *sliderh_class; | ||
15 | |||
16 | static void sliderh_save(t_gobj *z, t_binbuf *b) | ||
17 | { | ||
18 | |||
19 | t_fatom *x = (t_fatom *)z; | ||
20 | |||
21 | binbuf_addv(b, "ssiisiiisss", gensym("#X"),gensym("obj"), | ||
22 | x->x_obj.te_xpix, x->x_obj.te_ypix , | ||
23 | gensym("sliderh"),x->x_max,x->x_min,x->x_width,x->x_send,x->x_color,x->x_bgcolor); | ||
24 | binbuf_addv(b, ";"); | ||
25 | } | ||
26 | |||
27 | |||
28 | static void *sliderh_new(t_symbol* s, int argc, t_atom* argv) | ||
29 | { | ||
30 | t_fatom *x = (t_fatom *)pd_new(sliderh_class); | ||
31 | x->x_type = gensym("hslider"); | ||
32 | return fatom_new(x,argc,argv); | ||
33 | } | ||
34 | |||
35 | |||
36 | t_widgetbehavior sliderh_widgetbehavior; | ||
37 | |||
38 | |||
39 | |||
40 | |||
41 | void sliderh_setup(void) { | ||
42 | sliderh_class = class_new(gensym("sliderh"), (t_newmethod)sliderh_new, 0, | ||
43 | sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); | ||
44 | |||
45 | fatom_setup_common(sliderh_class); | ||
46 | |||
47 | sliderh_widgetbehavior.w_getrectfn = fatom_getrect; | ||
48 | sliderh_widgetbehavior.w_displacefn= fatom_displace; | ||
49 | sliderh_widgetbehavior.w_selectfn= fatom_select; | ||
50 | sliderh_widgetbehavior.w_activatefn=fatom_activate; | ||
51 | sliderh_widgetbehavior.w_deletefn= fatom_delete; | ||
52 | sliderh_widgetbehavior.w_visfn= fatom_vis; | ||
53 | #if PD_MINOR_VERSION < 37 | ||
54 | sliderh_widgetbehavior.w_savefn= sliderh_save; | ||
55 | sliderh_widgetbehavior.w_propertiesfn= NULL; | ||
56 | #endif | ||
57 | sliderh_widgetbehavior.w_clickfn= NULL; | ||
58 | |||
59 | class_setwidget(sliderh_class,&sliderh_widgetbehavior); | ||
60 | #if PD_MINOR_VERSION >= 37 | ||
61 | class_setsavefn(sliderh_class,&sliderh_save); | ||
62 | #endif | ||
63 | } | ||
64 | #include "m_pd.h" | ||
65 | #include "g_canvas.h" | ||
66 | |||
67 | |||
68 | #ifdef NT | ||
69 | #pragma warning( disable : 4244 ) | ||
70 | #pragma warning( disable : 4305 ) | ||
71 | #endif | ||
72 | |||
73 | #include "fatom.h" | ||
74 | |||
75 | /* can we use the normal text save function ?? */ | ||
76 | |||
77 | static t_class *sliderh_class; | ||
78 | |||
79 | static void sliderh_save(t_gobj *z, t_binbuf *b) | ||
80 | { | ||
81 | |||
82 | t_fatom *x = (t_fatom *)z; | ||
83 | |||
84 | binbuf_addv(b, "ssiisiiisss", gensym("#X"),gensym("obj"), | ||
85 | x->x_obj.te_xpix, x->x_obj.te_ypix , | ||
86 | gensym("sliderh"),x->x_max,x->x_min,x->x_width,x->x_send,x->x_color,x->x_bgcolor); | ||
87 | binbuf_addv(b, ";"); | ||
88 | } | ||
89 | |||
90 | |||
91 | static void *sliderh_new(t_symbol* s, int argc, t_atom* argv) | ||
92 | { | ||
93 | t_fatom *x = (t_fatom *)pd_new(sliderh_class); | ||
94 | x->x_type = gensym("hslider"); | ||
95 | return fatom_new(x,argc,argv); | ||
96 | } | ||
97 | |||
98 | |||
99 | t_widgetbehavior sliderh_widgetbehavior; | ||
100 | |||
101 | |||
102 | |||
103 | |||
104 | void sliderh_setup(void) { | ||
105 | sliderh_class = class_new(gensym("sliderh"), (t_newmethod)sliderh_new, 0, | ||
106 | sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); | ||
107 | |||
108 | fatom_setup_common(sliderh_class); | ||
109 | |||
110 | sliderh_widgetbehavior.w_getrectfn = fatom_getrect; | ||
111 | sliderh_widgetbehavior.w_displacefn= fatom_displace; | ||
112 | sliderh_widgetbehavior.w_selectfn= fatom_select; | ||
113 | sliderh_widgetbehavior.w_activatefn=fatom_activate; | ||
114 | sliderh_widgetbehavior.w_deletefn= fatom_delete; | ||
115 | sliderh_widgetbehavior.w_visfn= fatom_vis; | ||
116 | #if PD_MINOR_VERSION < 37 | ||
117 | sliderh_widgetbehavior.w_savefn= sliderh_save; | ||
118 | sliderh_widgetbehavior.w_propertiesfn= NULL; | ||
119 | #endif | ||
120 | sliderh_widgetbehavior.w_clickfn= NULL; | ||
121 | |||
122 | class_setwidget(sliderh_class,&sliderh_widgetbehavior); | ||
123 | #if PD_MINOR_VERSION >= 37 | ||
124 | class_setsavefn(sliderh_class,&sliderh_save); | ||
125 | #endif | ||
126 | } | ||