Include a header file required for build on mac 10.4
[supercollider.git] / Help / GUI / Cocoa-GUI / SC2DSlider.html
blobf1bc6722d8d68c53c9086aa814a93fba935b25ba
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0016bd}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001bec}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
17 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
19 p.p10 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
21 p.p12 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
22 p.p13 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
23 p.p14 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #2b7000}
24 p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
25 p.p16 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ae1a19}
26 p.p17 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
27 span.s1 {font: 18.0px Helvetica}
28 span.s2 {color: #000000}
29 span.s3 {text-decoration: underline}
30 span.s4 {color: #0016bd}
31 span.s5 {color: #606060}
32 span.s6 {color: #2b7000}
33 span.s7 {font: 14.0px Helvetica}
34 span.s8 {font: 9.0px Monaco}
35 span.Apple-tab-span {white-space:pre}
36 </style>
37 </head>
38 <body>
39 <p class="p1"><span class="s1"><b>SC2DSlider<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a two-dimensional GUI slider</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
40 <p class="p2"><br></p>
41 <p class="p3"><span class="s2"><b>Inherits from: </b><a href="../../Core/Object.html"><b>Object</b></a><b> : </b><a href="SCView.html"><b>SCView</b></a><b> : </b><a href="SCControlView.html"><b>SCControlView</b></a><b> : </b><a href="SCSliderBase.html"><b>SCSliderBase</b></a></span></p>
42 <p class="p2"><br></p>
43 <p class="p4"><span class="s2"><b>See also:</b> <a href="SC2DTabletSlider.html"><span class="s3">SC2DTabletSlider</span></a></span><span class="s4"> , <a href="SCTabletView.html"><span class="s3">SCTabletView</span></a></span></p>
44 <p class="p2"><br></p>
45 <p class="p5"><b>Some Important Issues Regarding SC2DSlider</b></p>
46 <p class="p2"><br></p>
47 <p class="p1">SC2DSlider values always have ranges between zero and one. You must scale the output and input values to your needs. Using <b>map</b> and <b>unmap,</b> combined with a <a href="../../Control/Spec.html"><span class="s4">Spec</span></a>, is helpful for this. To set the increment or decrement value of the slider, set the <b>step</b> .<span class="Apple-converted-space">  </span>By default, the shift, ctrl, and alt keys will modify the stepping by 100x, 10x, or 0.1x repectively, though you can customize this by setting <b>shift_scale, ctrl_scale, </b>or<b> alt_scale<span class="Apple-converted-space">  </span></b>(see <a href="SCSliderBase.html"><span class="s4">SCSliderBase</span></a>) . Drag and drop returns and accept a <a href="../../Geometry/Point.html"><span class="s4">Point</span></a>. Inherits some formatting form <a href="SCSliderBase.html"><span class="s4">SCSliderBase</span></a>.</p>
48 <p class="p2"><br></p>
49 <p class="p5"><b>Creation / Class Methods</b></p>
50 <p class="p6"><br></p>
51 <p class="p7"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
52 <p class="p8"><br></p>
53 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
54 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bounds </b>- An instance of <a href="../../Geometry/Rect.html"><span class="s4">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s4">Point</span></a> indicating width@height.</p>
55 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
56 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
57 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s4">Window</span>(<span class="s5">"2DSlider"</span>, <span class="s4">Rect</span>(100,100, 140 ,140)).front;</p>
58 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>t = <span class="s4">Slider2D</span>(w, <span class="s4">Rect</span>(20, 20,80, 80))</p>
59 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s4">|sl|</span></p>
60 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[<span class="s6">\sliderX</span>, sl.x, <span class="s6">\sliderY</span>, sl.y].postln;</p>
61 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
62 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
63 <p class="p6"><br></p>
64 <p class="p12"><b>Accessing Instance and Class Variables</b></p>
65 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
66 <p class="p7"><b><span class="Apple-tab-span"> </span>x</b></p>
67 <p class="p7"><b><span class="Apple-tab-span"> </span>x_ (val)</b></p>
68 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
69 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The horizontal value of the 2d slider. Gets/sets the property, \x, by calling get/setProperty(\x, <b>val</b>). This will not do the <b>action</b> of the slider.</p>
70 <p class="p6"><br></p>
71 <p class="p7"><b><span class="Apple-tab-span"> </span>activex_ (val)</b></p>
72 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
73 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Sets the property, \x, by calling setPropertyWithAction(\x, <b>val</b>). Does the sliders <b>action</b>, if the <b>x</b> value has changed.</p>
74 <p class="p6"><br></p>
75 <p class="p7"><b><span class="Apple-tab-span"> </span>y</b></p>
76 <p class="p7"><b><span class="Apple-tab-span"> </span>y_ (val)</b></p>
77 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
78 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The vertical value of the 2d slider. Gets/sets the property, \y, by calling get/setProperty(\y, <b>val</b>). This will not do the <b>action</b> of the slider.</p>
79 <p class="p6"><br></p>
80 <p class="p7"><b><span class="Apple-tab-span"> </span>activey_ (val)</b></p>
81 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
82 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Sets the property, \y, by calling setPropertyWithAction(\y, <b>val</b>). Does the sliders <b>action</b>, if the <b>y </b>value has changed.</p>
83 <p class="p6"><br></p>
84 <p class="p7"><b><span class="Apple-tab-span"> </span>setXY (x, y)</b></p>
85 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
86 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A convenience method which performs both the <b>x_</b> and <b>y_</b> setters. This will not do the <b>action</b> of the slider.</p>
87 <p class="p6"><br></p>
88 <p class="p7"><b><span class="Apple-tab-span"> </span>setXYActive (x, y)</b></p>
89 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
90 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>A convenience method which performs both the <b>x_</b> and <b>y_</b> setters. Does the action of the slider.</p>
91 <p class="p6"><br></p>
92 <p class="p7"><b><span class="Apple-tab-span"> </span>incrementY</b></p>
93 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
94 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Increments <b>y</b> by 1/bounds.height, unless the hight value is out of bounds. Does the action of the slider.</p>
95 <p class="p6"><br></p>
96 <p class="p7"><b><span class="Apple-tab-span"> </span>decrementY</b></p>
97 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
98 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Decrements <b>y</b> by 1/bounds.heitght, unless the hight value is out of bounds. Does the action of the slider.</p>
99 <p class="p6"><br></p>
100 <p class="p7"><b><span class="Apple-tab-span"> </span>incrementX</b></p>
101 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
102 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Increments <b>x</b> by 1/bounds.width, unless the hight value is out of bounds. Does the action of the slider.</p>
103 <p class="p6"><br></p>
104 <p class="p7"><b><span class="Apple-tab-span"> </span>decrementX</b></p>
105 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
106 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Decrements <b>x</b> by 1/bounds.width, unless the hight value is out of bounds. Does the action of the slider.</p>
107 <p class="p6"><br></p>
108 <p class="p12"><b>Subclassing and Internal Methods</b></p>
109 <p class="p7"><span class="s7"><span class="Apple-tab-span"> </span></span>The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
110 <p class="p6"><br></p>
111 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultKeyDownAction (char, modifiers, unicode)</b></p>
112 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
113 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default keydown actions are:</p>
114 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
115 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>key</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>comment</b></p>
116 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>r<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>activex_(1.rand), activey_(1.rand) with action </b><span class="Apple-tab-span"> </span>random</p>
117 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>activex_(0), activey_(0) with action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>left lower corner<span class="Apple-tab-span"> </span></p>
118 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>x<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>activex_(1), activey_(1) with action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>top left corner</p>
119 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>c<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>activex_(0.5), activey_(0.5) with action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>centered</p>
120 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF700, <span class="Apple-tab-span"> </span><b>incrementY</b> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>up arrow</p>
121 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF703, <span class="Apple-tab-span"> </span><b>incrementX</b> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>right arrow</p>
122 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF701, <span class="Apple-tab-span"> </span><b>decrementY</b> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>down arrow</p>
123 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF702, <span class="Apple-tab-span"> </span><b>decrement</b>X<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>left arrow</p>
124 <p class="p6"><br></p>
125 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultGetDrag</b></p>
126 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
127 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The method called by default when initiating a drag. Returns a <a href="../../Geometry/Point.html"><span class="s4">Point</span></a> (<b>lo</b>@<b>hi).</b></p>
128 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
129 <p class="p7"><span class="Apple-tab-span"> </span><b>defaultCanReceiveDrag</b></p>
130 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
131 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The method called by default when attempting to place a drag in this object. By default, SCSlider will respond only to drags where the drag contains a <a href="../../Geometry/Point.html"><span class="s4">Point</span></a>.</p>
132 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s8"><span class="Apple-tab-span"> </span></span></p>
133 <p class="p7"><span class="Apple-tab-span"> </span><b>defaultReceiveDrag</b></p>
134 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
135 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default method called when a drag has been recieved. The default action performed when receiving a drag. Sets <b>x</b> and <b>y</b> respectively using the <a href="../../Geometry/Point.html"><span class="s4">Point</span></a> ( currentDrag.x@currentDrag.y) . Performs the action.</p>
136 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
137 <p class="p7"><b><span class="Apple-tab-span"> </span>properties</b></p>
138 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
139 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>A list of properties to which this view responds. See <a href="SCView.html"><span class="s4">SCView</span></a>.</p>
140 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
141 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns:</p>
142 <p class="p14"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[ </span>\bounds<span class="s2">, </span>\visible<span class="s2">, </span>\enabled<span class="s2">, </span>\canFocus<span class="s2">, </span>\resize<span class="s2">, </span>\background<span class="s2">, </span>\minWidth<span class="s2">, </span>\maxWidth<span class="s2">, </span>\minHeight<span class="s2">, </span>\maxHeight<span class="s2">, </span>\knobColor<span class="s2">, </span>\step<span class="s2">, </span>\x<span class="s2">, </span>\y<span class="s2"> ]</span></p>
143 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
144 <p class="p12"><b>Examples</b></p>
145 <p class="p15"><br></p>
146 <p class="p11">(</p>
147 <p class="p11">w = <span class="s4">Window</span>(<span class="s5">"Slider2D"</span>, <span class="s4">Rect</span>(100,100, 140 ,140));</p>
148 <p class="p11">t = <span class="s4">Slider2D</span>(w, <span class="s4">Rect</span>(20, 20,80, 80))</p>
149 <p class="p16"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.x_(0.5)<span class="Apple-tab-span"> </span></span>// initial location of x</p>
150 <p class="p16"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.y_(1)<span class="Apple-tab-span"> </span></span>// initial location of y</p>
151 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s4">|sl|</span></p>
152 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[<span class="s6">\sliderX</span>, sl.x, <span class="s6">\sliderY</span>, sl.y].postln;</p>
153 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
154 <p class="p11">w.front;</p>
155 <p class="p11">)</p>
156 <p class="p15"><br></p>
157 <p class="p16"><span class="s2">t.x <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// get the x loc</p>
158 <p class="p16"><span class="s2">t.x_(0.25) <span class="Apple-tab-span"> </span></span>// set the x loc</p>
159 <p class="p15"><br></p>
160 <p class="p15"><br></p>
161 <p class="p16">// drag an drop Points</p>
162 <p class="p11">(</p>
163 <p class="p11">w = <span class="s4">Window</span>(<span class="s5">"Slider2D"</span>, <span class="s4">Rect</span>(100,100, 500 ,300));</p>
164 <p class="p11">w.view.decorator = <span class="s4">FlowLayout</span>(w.view.bounds);</p>
165 <p class="p11">t = <span class="s4">Slider2D</span>(w, <span class="s4">Rect</span>(20, 20,280, 280))</p>
166 <p class="p16"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.x_(0.5)<span class="Apple-tab-span"> </span></span>// initial location of x</p>
167 <p class="p16"><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.y_(1)<span class="Apple-tab-span"> </span></span>// initial location of y</p>
168 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s4">Color</span>.rand )</p>
169 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s4">|sl|</span></p>
170 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[<span class="s6">\sliderX</span>, sl.x, <span class="s6">\sliderY</span>, sl.y].postln;</p>
171 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
172 <p class="p11">t.step_(0.01);</p>
173 <p class="p15"><br></p>
174 <p class="p11">n=<span class="s4">CompositeView</span>.new(w, 200@300);</p>
175 <p class="p11">n.decorator= <span class="s4">FlowLayout</span>(n.bounds);</p>
176 <p class="p15"><br></p>
177 <p class="p11">v = { <span class="s4">|i|</span> <span class="s4">DragBoth</span>.new(n, <span class="s4">Rect</span>(0, i * 20, 200, 20)).background_( <span class="s4">Color</span>.rand ).align_(<span class="s6">\center</span>) }.dup(5);</p>
178 <p class="p15"><br></p>
179 <p class="p17"><span class="s4">StaticText</span><span class="s2">.new(n,200@150).string_(</span>"hold down cmd and drag points from the slider to the drag slots, or reverse"<span class="s2">).stringColor_(</span><span class="s4">Color</span><span class="s2">.white);</span></p>
180 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
181 <p class="p15"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
182 <p class="p11">w.front;</p>
183 <p class="p11">)</p>
184 <p class="p15"><br></p>
185 <p class="p16">// Shape a Sound</p>
186 <p class="p11">(</p>
187 <p class="p11">s.waitForBoot({</p>
188 <p class="p11"><span class="Apple-tab-span"> </span>a={<span class="s4">arg</span> mod=0.05, index=0.05;</p>
189 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">var</span> r,out,out2;</p>
190 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>r=<span class="s4">Saw</span>.ar(8,0.03);</p>
191 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>out=<span class="s4">PMOsc</span>.ar(440,</p>
192 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>660*mod,3*index, 0,</p>
193 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">Lag</span>.ar(r,0.01,1));</p>
194 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[out,<span class="s4">Delay1</span>.ar(out)];</p>
195 <p class="p15"><br></p>
196 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>}.play;</p>
197 <p class="p15"><br></p>
198 <p class="p11"><span class="Apple-tab-span"> </span>w = <span class="s4">Window</span>(<span class="s5">"Slider2D"</span>, <span class="s4">Rect</span>(100,<span class="s4">Window</span>.screenBounds.height-400, 300 ,300));</p>
199 <p class="p11"><span class="Apple-tab-span"> </span>w.view.decorator = <span class="s4">FlowLayout</span>(w.view.bounds);</p>
200 <p class="p11"><span class="Apple-tab-span"> </span>t = <span class="s4">Slider2D</span>(w, <span class="s4">Rect</span>(0, 0,292, 292))</p>
201 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.y_(0.05)</p>
202 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.x_(0.05)</p>
203 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s4">Color</span>.rand )</p>
204 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_(<span class="s4">Color</span>.rand)</p>
205 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s4">|sl|</span></p>
206 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.set(<span class="s6">\mod</span>,sl.x,<span class="s6">\index</span>,sl.y);</p>
207 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
208 <p class="p15"><span class="Apple-tab-span"> </span></p>
209 <p class="p11"><span class="Apple-tab-span"> </span>w.front;</p>
210 <p class="p11"><span class="Apple-tab-span"> </span><span class="s4">CmdPeriod</span>.doOnce({w.close});</p>
211 <p class="p11">})</p>
212 <p class="p11">)</p>
213 <p class="p15"><br></p>
214 <p class="p15"><br></p>
215 </body>
216 </html>