File: GeneralHIDGUI.sc

package info (click to toggle)
supercollider 1%3A3.6.6~repack-2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,792 kB
  • ctags: 25,269
  • sloc: cpp: 177,129; lisp: 63,421; ansic: 11,297; python: 1,787; perl: 766; yacc: 311; sh: 286; lex: 181; ruby: 173; makefile: 168; xml: 13
file content (66 lines) | stat: -rw-r--r-- 1,823 bytes parent folder | download
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
GeneralHIDDeviceGUI{
	var <win, <updater;
	var <device;
	var buttons;
	var sliders;
	var relsliders;

	var <bkeys,<akeys,<rkeys;

	*new{ |device|
		^super.new.init(device);
	}

	init{ |dev|
		device = dev;
		win = GUI.window.new( device.info.name, Rect( 0, 0, 400, 400 ));
		win.view.decorator = FlowLayout( win.bounds );

		EZText.new( win, 390@20 , "name", initVal: device.info.name );

		EZText.new( win, 390@20, "findArgs", initVal: device.info.findArgs );

		win.view.decorator.nextLine;

		// buttons:
		if ( device.slots[1].notNil, {
			bkeys = device.slots[1].keys.asArray.sort;
			buttons = bkeys.collect{ |key,it|
            EZNumber.new( win, 30@40, device.slots[1][key].id.asString, [0,1,\linear,1].asSpec, labelWidth: 30, layout: 'line2', gap:0@0, margin: 0@0 );
			};
		});
		win.view.decorator.nextLine;

		// absolute slots:
		if ( device.slots[3].notNil, {
			akeys = device.slots[3].keys.asArray.sort;
         sliders = akeys.collect{ |key,it|
            EZSlider.new( win, 30@80, device.slots[3][key].id.asString, labelWidth: 30, layout: 'vert',gap:0@0,margin:0@0 );
			};
		});
		win.view.decorator.nextLine;

		// relative slots:

		if ( device.slots[2].notNil, {
			rkeys = device.slots[2].keys.asArray.sort;
			relsliders = rkeys.collect{ |key,it|
            EZSlider.new( win, 30@80, device.slots[2][key].id.asString, labelWidth: 30, layout: 'vert',gap:0@0,margin:0@0 );
			};
		});

		win.front;

		updater = SkipJack.new( {
			if ( bkeys.notNil, {
				bkeys.do{ |key,k,v| buttons[k].value = device.slots[1][key].value };
			});
			if ( rkeys.notNil, {
				rkeys.do{ |key,k,v| relsliders[k].value = device.slots[2][key].value };
			});
			if ( akeys.notNil, {
				akeys.do{ |key,k,v| sliders[k].value = device.slots[3][key].value };
			});
		}, 0.2, win.isClosed, name: "GeneralHIDGUI" );
	}
}