diff options
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 | } | ||