-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabredraw.c
38 lines (31 loc) · 889 Bytes
/
tabredraw.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "m_pd.h"
static t_class *tabredraw_class;
typedef struct _tabredraw {
t_object x_obj;
t_symbol *x_arrayname;
} t_tabredraw;
static void tabredraw_bang(t_tabredraw *x)
{
t_garray *array;
if (!(array = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) {
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
return;
}
garray_redraw(array);
}
static void *tabredraw_new(t_symbol *s)
{
t_tabredraw *x = (t_tabredraw *)pd_new(tabredraw_class);
x->x_arrayname = s;
return (x);
}
void tabredraw_setup(void)
{
tabredraw_class = class_new(gensym("tabredraw"),
(t_newmethod)tabredraw_new,
0, // No free needed since we only store a symbol
sizeof(t_tabredraw),
0, // No flags needed
A_DEFSYM, 0);
class_addbang(tabredraw_class, (t_method)tabredraw_bang);
}