2 summary:: a line of editing controls for a Pdef, and optionally its envir
3 categories:: Libraries>JITLib>GUI
4 related:: Classes/PdefAllGui, Classes/TdefGui, Classes/TdefAllGui
8 A gui showing the link::Classes/Pdef::'s name, playing state, source state, and envir state. Optionally, its envir can also be edited.
10 subsection::First example
13 g = PdefGui(); // make a PdefGui
14 g.object = Pdef(\a); // show when a Pdef is put in
15 Pdef(\a, Pbind(\note, 12)); // show whether it has a source
16 Pdef(\a).play; // show whether playing, stopped, or ended, and pausable
17 Pdef(\a).set(\dur, 0.25); // show whether the Pdef has an envir
20 g = PdefGui(Pdef(\a), 3); // with an envirgui for 3 items
21 Pdef(\a).set(\lofreq, [1, 10], \str, "someString", \oops, \oneSymbolTooMany);
26 ( // put it in an existing window - margin is 0@0
27 w = Window("my win", Rect(200, 200, 300, 200)).front;
29 PdefGui(Pdef(\a), 0, w);
30 PdefGui(Pdef(\a), 3, w);
34 subsection::Details on the GUI elements
38 || when selected, typing the delete key will delete its Pdef.
40 || indicates whether the Pdef is playing:
42 ## " >" || if stopped,
43 ## " _" || if playing and active,
44 ## " |" || if it is playing, but the stream has ended.
46 ## pause/resume button
47 || only visible if one can pause or resume the Pdef, i.e. while it is playing.
49 ## "paus" || shown when you can pause it,
50 ## "rsum" || shown when you can resume it.
53 || opens a document to edit the source (function) of the Pdef.
55 ## green || a source exists,
56 ## white || the source is nil.
59 || opens a document to edit the environment of the Pdef, which is where one can keep all variables the Pdef uses for easy access.
61 ## green || the Pdef has an envir,
62 ## white || the envir is nil.
68 subsection::Creation Methods
71 Create a new link::Classes/JITGui:: that will be watching an object and display its state.
77 the number of display items to use, e.g. how many fields for text, or how many EZSliders for single-number parameters.
80 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.
83 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 link::Classes/Point:: or link::Classes/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.
86 A flag whether to make a skipjack.
89 a list of additional information, e.g. flags about optional buttons. (this is used is some subclasses)
94 a link::Classes/Pdef::, or nil
97 the number of items in the envirGui
103 the bounds of the link::#-zone::
106 the link::Classes/CompositeView:: within which the PdefGui is shown
108 method::nameBut, playBut, pauseBut, srcBut, envBut
112 the gui for the Pdef's envir - nil if numItems is 0.
115 put an object in the gui.
118 (if the jitGui is in its own window)
120 move it to some specific location.
123 (if the jitGui is in its own window)
125 set the PdefGui's object to nil
128 (if the jitGui is in its own window)
130 and close its window.
132 subsection::Internal methods
135 a compileString that recreates the Pdef.
138 // assume g from above is still there
143 a compileString that recreates the Pdef's envir at edKey.
146 a compileString that recreates the Pdef's envir at edKeys.
149 Default value is nil.
152 // assume g from above is still there
154 Pdef(\a).set(\foo, \bar);
161 the keys in use in the envir
168 open a document with some strings at some location
171 g.openDoc(g.editStrings);
175 make an envirGui within zone - called internally.
180 Pdef(\a, Pbind(\freq, Prand((1..16) * 55, inf)));
182 t = PdefGui(Pdef(\a), 4);
183 Pdef(\a).set(\dur, 0.125, \amp, 0.05);
194 w = Window("put it in a selfmade window").front;
196 w.view.decorator.shift(50, 50);
197 PdefGui(Pdef(\a), 12, w);
200 Pdef(\b, Pbind(\note, Pxrand((0..7), inf), \dur, 0.125));