2 summary:: a superclass for just in time interfaces
3 categories:: Libraries>JITLib>GUI
6 Proxies for synths, tasks and patterns as implemented in JITLib are extremely flexible. Having guis that represent their changeable states makes it easier to understand what is going on, especially when using multiple proxies together. JITGuis follow a special strategy described below.
11 ## link::Classes/EnvirGui::,
12 ## link::Classes/TdefGui::, link::Classes/TdefAllGui::, ( link::Classes/TaskProxyGui:: ) // TdefGui replaces obsolete TdefEditor
13 ## link::Classes/PdefGui::, link::Classes/PdefAllGui::, ( link::Classes/TaskProxyAllGui:: ) // PdefGui replaces obsolete PdefEditor
14 ## link::Classes/NdefGui::, link::Classes/MonitorGui::, link::Classes/NdefParamGui:: // replace NodeProxyEditor, ProxyMonitorGui
15 ## link::Classes/ProxyMixer::
16 ## link::Classes/NdefMixer::
19 subsection::still to be done
22 ## (ProxyChain) ProxyChainGui
23 ## (PxPreset) PxPresetGui
34 Create a new JITGui that will be watching an object and displaying its state.
37 g = JITGui.new(nil, 0); // make one
38 g.object = 123; // object gets shown asCompileString
39 g.object = (key: \otto); // if the object understands .key, key gets shown
40 g.object = Pseq([1, 2, 3], inf);
48 the number of display items to use, e.g. how many fields for text, or how many EZSliders for single-number parameters.
51 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.
54 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
57 A flag whether to make a skipjack.
60 a list of additional information, e.g. flags about optional buttons. (this is used is some subclasses)
64 subsection::Accessing Instance Variables
74 the number of display items to use, e.g. how many fields for text, or how many EZSliders for single-number parameters.
77 a parent view on which the gui is displayed.
80 the size and position of the JITGui
83 a link::Classes/CompositeView:: inside the parent that holds the JITGui's views.
86 a JITGuis calculates its own minimum size based on numItems and options.
89 the default position where the JITGui is shown if it is in its own window.
94 the GUI skin to use. By default this is code::GUI.skins.jit:: .
99 the font, also taken from JITGui.skin.
102 (specific in the JITGui class)
104 displays the object's key if available.
107 (specific in the JITGui class)
109 displays the object's compileString.
112 (common to all JITGuis)
114 the last observed state which is kept around for comparison.
117 (common to all JITGuis)
119 the skipjack that watches the object's state so it can be updated.
122 (common to all JITGuis)
124 an link::Classes/EZScroller:: used for scrolling which of a list of items is shown. see e.g. link::Classes/TdefGui:: for usage.
127 (common to all JITGuis)
129 a flag whether the JITGui has made its own window, and thus owns it.
131 subsection::Instance Methods
134 put an object in the gui - if the gui accepts it.
137 test whether obj is a valid object to show in a JITGui. In strong::JITGui:: itself, all objects are accepted, in the subclasses, strong::obj:: can either be nil or a specific class, such as link::Classes/Tdef::, link::Classes/Pdef::, link::Classes/Ndef::
140 set the text of the link::#-nameView:: and the window (if it link::#-hasWindow::)
143 ask the object its name, or return code::'_anon_'::
146 return a suitable name for a window: "JITGui_objname"
149 if it has its own window, one can move it to some specific location.
154 subsection::How JITGuis work
156 A JITGui watches the state of its object by calling its (the gui's) link::#-getState:: method. It compares the new state of the object with the previous state stored in link::#-prevState::. When something has changed, the gui elements concerned are updated.
158 subsection::How JITGuis work: Methods that subclasses should implement
160 You can write your own subclasses to JITGui very efficiently by implementing appropriate variants of the following methods in your class. For examples of these methods, see link::Classes/TdefGui::, link::Classes/EnvirGui::, link::Classes/NdefGui::.
163 used to calculate the required onscreen size for the jitGui's zone. Should determine zone size based on link::#-numItems:: and options. also, link::#-defPos:: (where to show your jitGui by default) can be set here, and possibly modifications to the skin used.
166 a test whether strong::obj:: can be shown in the particular kind of JITGui. Subclasses of JITGui are made for special objects, e.g. Pdefs, so they should test whether obj is the right kind.
169 create all the views of the jitGui inside the zone.
171 subsection::How JITGuis work: For updating the JITGui, these are essential
174 ask the object for all aspects of its current state that will be displayed.
177 get the object's current state with link::#-prevState::, compare it with prevState, update all gui elements that need to be changed, and store the new state as prevState. This method is called in the skipJack.
179 subsection::How JITGuis work: More methods you may want to overwrite if required
182 how to calculate the bounds for the zone in which to display
185 how to make a window when no parent is given
188 how to initalize the zone within the parent window or view
191 a method for generating a name for the object.
194 a method for generating a name for the JITGui's window.
197 Some objects may have more elements to display than the gui has slots, e.g. a link::Classes/ProxySpace:: can have more proxies than the mixer has numItems. Then, only link::#-numItems:: elements are shown, and the others can be scrolled to with link::#-scroller:: - an link::Classes/EZScroller:: next to the slot elements. The makeScroller method knows where in the zone to put the scroller.
204 // make its own window - defPos, minSize is used
205 g = JITGui(Ndef(\a));
207 // make its own window, specific size
208 g = JITGui(Ndef(\a), bounds: 390@20);
210 // provide full bounds
211 g = JITGui(Ndef(\a), bounds: Rect(200, 500, 390, 24));
213 // extent is 0@0: minSize x, y is used
214 g = JITGui(Ndef(\a), bounds: Rect(200, 500, 0, 0));
215 g = JITGui(Ndef(\a), bounds: Rect(200, 500, 0, 50));
216 g = JITGui(Ndef(\a), bounds: Rect(200, 500, 500, 0));
219 ( // put a JITGui in an existing window:
221 g = JITGui(Ndef(\a), 0, w, bounds: 300@48);
226 g = JITGui(Ndef(\a), 5, w);
229 ( // recommended: use a FlowLayout.
232 EZSlider(w, 300@100, \test, []);
233 g = JITGui(Ndef(\a), 0, w, bounds: 300@40);