aboutsummaryrefslogtreecommitdiff
path: root/test/paramDump.c
blob: b9f73b913ae5513360b847d4f0622f3d342afccb (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 *      paramDump.c
 *      
 *      Copyright 2009 Thomas O Fredericks <tom@hp>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


#include "tof.h"
#include "param.h"


static t_class *paramDump_class;
 

typedef struct _paramDump
{
  t_object                    x_obj;
  t_outlet*			          outlet;
  //t_symbol*						s_set;
  t_symbol*					root;
} t_paramDump;



static void paramDump_guis(t_paramDump *x, t_symbol* s) {
	
	
		
		t_param* p = get_param_list(x->root);
		int ac;
		t_atom* av;
		
		while (p) {
			if (p->GUI ) {
				p->GUI(p->x,&ac,&av);
				outlet_anything(x->outlet,p->path,ac,av);
				
			}
		p = p->next;
		}
		
}


// Dump out everything (OR THE ID'S OR JUST THE NAMES?)
static void paramDump_bang(t_paramDump *x) {
	
	t_param* p = get_param_list(x->root);
	#ifdef PARAMDEBUG
	if (p == NULL) {
		post("No params found");
	} else {
		post("Found params");
	}
	#endif
	
	t_symbol* selector;
	int ac;
	t_atom* av;
	
	while (p) {
		if ( p->get ) {
			p->get(p->x, &selector, &ac, &av);
			tof_outlet_anything_prepend(x->outlet,selector,ac,av,p->path);
		}
		p = p->next;
	}
	
    
}



static void paramDump_free(t_paramDump *x)
{
	
	
}


static void *paramDump_new(t_symbol *s, int ac, t_atom *av) {
  t_paramDump *x = (t_paramDump *)pd_new(paramDump_class);
  
  x->root = tof_get_dollarzero(tof_get_root_canvas(tof_get_canvas()));
  
  
    //x->s_set = gensym("set");
	
    x->outlet = outlet_new(&x->x_obj, &s_list);
    
  return (x);
}

void paramDump_setup(void) {
  paramDump_class = class_new(gensym("paramDump"),
    (t_newmethod)paramDump_new, (t_method)paramDump_free,
    sizeof(t_paramDump), 0, A_GIMME, 0);

 class_addbang(paramDump_class, paramDump_bang);
 
 //class_addmethod(paramDump_class, (t_method) paramDump_values, gensym("values"), A_DEFSYMBOL,0);
 
 class_addmethod(paramDump_class, (t_method) paramDump_guis, gensym("guis"), A_DEFSYMBOL,0);
 //class_addmethod(paramDump_class, (t_method) paramDump_update_guis, gensym("update"), A_DEFSYMBOL,0);

}