2 summary:: a line of editing controls for a Tdef, and optionally its envir
3 categories:: Libraries>JITLib>GUI
4 related:: Classes/TdefAllGui, Classes/PdefGui, Classes/PdefAllGui
8 A gui showing the link::Classes/Tdef::'s name, playing state, source state, and envir state. Optionally, its envir can also be edited.
10 subsection::First example
13 g = TdefGui(); // make a TdefGui
14 g.object = Tdef(\a); // show when a Tdef is put in
15 Tdef(\a, { "boing".postln }); // show whether it has a source
16 Tdef(\a).play; // show whether playing, stopped, or ended, and pausable
17 Tdef(\a).set(\abc, 123); // show whether the tdef has an envir
19 g = TdefGui(Tdef(\a), 3); // with an envirgui for 3 items
20 Tdef(\a).set(\a, 12, \lofreq, [1, 10], \str, "someString", \oops, \oneSymbolTooMany);
22 ( // put it in an existing window - margin becomes 0@0
23 w = Window().front; w.addFlowLayout;
24 TdefGui(Tdef(\a), 0, w);
25 TdefGui(Tdef(\a), 3, w);
29 subsection::Details on the GUI elements
33 || when selected, typing the delete key will delete its Tdef.
35 || indicates whether the tdef is playing:
37 ## " >" || if stopped,
38 ## " _" || if playing and active,
39 ## " |" || if it is playing, but the stream has ended.
41 ## pause/resume button
42 || only visible if one can pause or resume the Tdef, i.e. while it is playing.
44 ## "paus" || shown when you can pause it,
45 ## "rsum" || shown when you can resume it.
48 || opens a document to edit the source (function) of the Tdef.
50 ## green || a source exists,
51 ## white || the source is nil.
54 || strong::click:: opens a document to edit the envir of the Tdef, strong::option-click:: opens a new TdefGui with a big enough link::Classes/EnvirGui:: for the Tdef's envir.
56 ## green || the Tdef has an envir,
57 ## white || the envir is nil.
63 subsection::Creation Methods
66 Create a new link::Classes/JITGui:: that will be watching an object and display its state.
72 the number of display items to use, e.g. how many fields for text, or how many EZSliders for single-number parameters.
75 a parent view on which to display. If nil, a new window is created; strong::parent:: can also be an existing window or a composite view.
78 a desired size and position where to display a JITGui. can be nil, a link::Classes/Point::, or a link::Classes/Rect::. JITGuis know their minimum size ( strong::minSize:: ), and if bounds is nil, minSize is used. if bounds is a point or rect, it will be set to at least minSize. With a rect one can also supply a position where to display. If a point,shown size is the maximum of bounds and minSize
81 A flag whether to make a skipjack. If one uses a TdefGui as part of a larger gui ensemble, one may want to call checkUpdate on all of them together, not with separate skipJacks.
84 a list of additional information, e.g. flags about optional buttons. (this is used is some subclasses)
89 a link::Classes/Tdef::, or nil
92 the number of items in the envirGui
98 the bounds of the link::#-zone::
101 the link::Classes/CompositeView:: within which the TdfGui is shown
104 method::nameBut, playBut, pauseBut, srcBut, envBut
108 the gui for the Tdef's envir - if numItems > 0.
111 put an object in the gui.
114 (if the jitGui is in its own window)
116 move it to some specific location.
119 (if the jitGui is in its own window)
121 set the TdefGui's object to nil
124 (if the jitGui is in its own window)
126 and close its window.
128 subsection::Internal methods
131 a compileString that recreates the Tdef.
134 // assume g from above is still there
139 a compileString that recreates the Tdef's envir at edKey.
142 a compileString that recreates the Tdef's envir at edKeys.
145 Default value is nil.
148 // assume g from above is still there
150 Tdef(\a).set(\foo, \bar);
157 the keys in use in the envir
164 open a document with some strings at some location. used with src button, env button.
167 g.openDoc(g.editStrings);
171 make an envirGui within zone.
177 Tdef(\a, { |e| 100.do { |i| i.postln; 0.5.wait } });
178 t = TdefGui(Tdef(\a), 4);
179 Tdef(\a).set(\freq, 200, \dur, 0.1, \otto, 12, \ann, 1234);
191 w = Window("put it in a selfmade window").front;
193 w.view.decorator.shift(50, 50);
194 TdefGui(Tdef(\a), 12, w)
197 Tdef(\b, { |e| 100.do { |i| Tdef(\a).set(\otto, 8.rand); exprand(0.1, 3.0).wait } });