Skip to content

Commit

Permalink
made GUI examples cross-platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
sciss committed Feb 3, 2008
1 parent 857c739 commit 6dadbd4
Show file tree
Hide file tree
Showing 8 changed files with 1,366 additions and 1,345 deletions.
1,572 changes: 787 additions & 785 deletions build/examples/GUI examples/ColorBrowser.rtf

Large diffs are not rendered by default.

451 changes: 224 additions & 227 deletions build/examples/GUI examples/GUI_examples1.rtf

Large diffs are not rendered by default.

390 changes: 198 additions & 192 deletions build/examples/GUI examples/GUI_examples2.rtf

Large diffs are not rendered by default.

111 changes: 56 additions & 55 deletions build/examples/GUI examples/Nick's LetterGimmick.rtf
@@ -1,79 +1,80 @@
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue191;\red191\green0\blue0;\red96\green96\blue96;
\red0\green115\blue0;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue191;\red191\green0\blue0;
\red96\green96\blue96;\red0\green115\blue0;}
\deftab160
\pard\tqr\tx1180\tx1200\pardeftab160\li1200\fi-1200\ql\qnatural

\f0\fs24 \cf0 \
\f0\fs24 \cf2 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab160\ql\qnatural

\f1\fs18 \cf0 (\
\cf2 var\cf0 linetext, drawletter;\
\cf2 var\cf0 w, h = 800, v = 60, seed = \cf2 Date\cf0 .seed, run = \cf2 true\cf0 ;\
\cf2 var\cf0 time, name, sourcestring;\
\cf2 var\cf0 yellowness, penwidth;\
\f1\fs18 \cf2 (\
\cf3 var\cf2 linetext, drawletter;\
\cf3 var\cf2 w, h = 800, v = 60, seed = \cf3 Date\cf2 .seed, run = \cf3 true\cf2 ;\
\cf3 var\cf2 time, name, sourcestring;\
\cf3 var\cf2 yellowness, penwidth, pen;\
\
\cf3 //name=[\\s,\\u,\\p,\\e,\\r,\\c,\\o,\\l,\\l,\\i,\\d,\\e,\\r];\cf0 \
\cf4 //name=[\\s,\\u,\\p,\\e,\\r,\\c,\\o,\\l,\\l,\\i,\\d,\\e,\\r];\cf2 \
\
\cf3 //sourcestring= "any lower case text";\cf0 \
\cf4 //sourcestring= "any lower case text";\cf2 \
\
sourcestring= \cf4 "welcome to supercollider"\cf0 ;\
sourcestring= \cf5 "welcome to supercollider"\cf2 ;\
\
name=\cf2 Array\cf0 .fill(sourcestring.size,\{\cf2 arg\cf0 i; sourcestring[i].asSymbol\});\
name=\cf3 Array\cf2 .fill(sourcestring.size,\{\cf3 arg\cf2 i; sourcestring[i].asSymbol\});\
\
time=0;\
\
linetext= (\
\cf5 'a'\cf0 :[[[0,1],[0.5,0]],[[0.5,0],[1,1]],[[0.25,0.5],[0.75,0.5]]],\
\cf5 'b'\cf0 :[[[0,1],[0,0]],[[0,1],[1,1]],[[0,0],[1,0]],[[0,0.5],[0.75,0.5]],[[0.75,0.5],[1,0.75]],[[0.75,0.5],[1,0.25]],[[1,0.75],[1,1]],[[1,0.25],[1,0]]],\
\cf5 'c'\cf0 :[[[0,1],[0,0]],[[0,0],[1,0]],[[0,1],[1,1]]],\
\cf5 'd'\cf0 :[[[0,1],[0,0]],[[0,0],[0.75,0]],[[0,1],[0.75,1]],[[0.75,1],[1,0.75]],[[0.75,0],[1,0.25]],[[1,0.25],[1,0.75]]],\
\cf5 'e'\cf0 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,1],[1,1]],[[0,0.5],[1,0.5]]],\
\cf5 'f'\cf0 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,0.5],[1,0.5]]],\
\cf5 'g'\cf0 :[[[0,1],[0,0]],[[0,0],[1,0]],[[0,1],[1,1]],[[1,1],[1,0.5]],[[0.5,0.5],[1,0.5]]],\
\cf5 'h'\cf0 :[[[0,1],[0,0]],[[0,0.5],[1,0.5]],[[1,1],[1,0]]],\
\cf5 'i'\cf0 :[[[0,0],[1,0]],[[0.5,0],[0.5,1]],[[0,1],[1,1]]],\
\cf5 'j'\cf0 :[[[0,0],[1,0]],[[0.5,0],[0.5,1]],[[0,1],[0.5,1]]],\
\cf5 'k'\cf0 :[[[0,1],[0,0]],[[0,0.5],[1,1]],[[0,0.5],[1,0]]],\
\cf5 'l'\cf0 :[[[0,1],[0,0]],[[0,1],[1,1]]],\
\cf5 'm'\cf0 :[[[0,1],[0,0]],[[0,0],[0.5,0.5]],[[0.5,0.5],[1,0]],[[1,0],[1,1]]],\
\cf5 'n'\cf0 :[[[0,1],[0,0]],[[0,0],[1,1]],[[1,1],[1,0]]],\
\cf5 'o'\cf0 :[[[0,1],[0,0]],[[0,0],[1,0]],[[0,1],[1,1]],[[1,0],[1,1]]],\
\cf5 'p'\cf0 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,0.5],[1,0.5]],[[1,0],[1,0.5]]],\
\cf5 'q'\cf0 :[[[0,0],[0,0.75]],[[0,0],[0.75,0]],[[0,0.75],[0.75,0.75]],[[0.75,0],[0.75,0.75]],[[0.5,0.5],[1,1]]],\
\cf5 'r'\cf0 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,0.5],[1,0.5]],[[1,0],[1,0.5]],[[0,0.5],[1,1]]],\
\cf5 's'\cf0 :[[[0,0],[0,0.5]],[[0,0],[1,0]],[[0,1],[1,1]],[[0,0.5],[1,0.5]],[[1,0.5],[1,1]]],\
\cf5 't'\cf0 :[[[0,0],[1,0]],[[0.5,0],[0.5,1]]],\
\cf5 'u'\cf0 :[[[0,1],[0,0]],[[0,1],[1,1]],[[1,0],[1,1]]],\
\cf5 'v'\cf0 :[[[0,0],[0.5,1]],[[0.5,1],[1,0]]],\
\cf5 'w'\cf0 :[[[0,0],[0.25,1]],[[0.25,1],[0.5,0.5]],[[0.5,0.5],[0.75,1]],[[0.75,1],[1,0]]],\
\cf5 'x'\cf0 :[[[0,0],[1,1]],[[0,1],[1,0]]],\
\cf5 'y'\cf0 :[[[0,0],[0.5,0.5]],[[0.5,0.5],[1,0]],[[0.5,0.5],[0.5,1]]],\
\cf5 'z'\cf0 :[[[0,1],[1,0]],[[0,0],[1,0]],[[0,1],[1,1]]],\
(\cf4 " "\cf0 .asSymbol):[[[0,1],[1,1]],[[0,0.8],[0,1]],[[1,0.8],[1,1]]]\
\cf6 'a'\cf2 :[[[0,1],[0.5,0]],[[0.5,0],[1,1]],[[0.25,0.5],[0.75,0.5]]],\
\cf6 'b'\cf2 :[[[0,1],[0,0]],[[0,1],[1,1]],[[0,0],[1,0]],[[0,0.5],[0.75,0.5]],[[0.75,0.5],[1,0.75]],[[0.75,0.5],[1,0.25]],[[1,0.75],[1,1]],[[1,0.25],[1,0]]],\
\cf6 'c'\cf2 :[[[0,1],[0,0]],[[0,0],[1,0]],[[0,1],[1,1]]],\
\cf6 'd'\cf2 :[[[0,1],[0,0]],[[0,0],[0.75,0]],[[0,1],[0.75,1]],[[0.75,1],[1,0.75]],[[0.75,0],[1,0.25]],[[1,0.25],[1,0.75]]],\
\cf6 'e'\cf2 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,1],[1,1]],[[0,0.5],[1,0.5]]],\
\cf6 'f'\cf2 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,0.5],[1,0.5]]],\
\cf6 'g'\cf2 :[[[0,1],[0,0]],[[0,0],[1,0]],[[0,1],[1,1]],[[1,1],[1,0.5]],[[0.5,0.5],[1,0.5]]],\
\cf6 'h'\cf2 :[[[0,1],[0,0]],[[0,0.5],[1,0.5]],[[1,1],[1,0]]],\
\cf6 'i'\cf2 :[[[0,0],[1,0]],[[0.5,0],[0.5,1]],[[0,1],[1,1]]],\
\cf6 'j'\cf2 :[[[0,0],[1,0]],[[0.5,0],[0.5,1]],[[0,1],[0.5,1]]],\
\cf6 'k'\cf2 :[[[0,1],[0,0]],[[0,0.5],[1,1]],[[0,0.5],[1,0]]],\
\cf6 'l'\cf2 :[[[0,1],[0,0]],[[0,1],[1,1]]],\
\cf6 'm'\cf2 :[[[0,1],[0,0]],[[0,0],[0.5,0.5]],[[0.5,0.5],[1,0]],[[1,0],[1,1]]],\
\cf6 'n'\cf2 :[[[0,1],[0,0]],[[0,0],[1,1]],[[1,1],[1,0]]],\
\cf6 'o'\cf2 :[[[0,1],[0,0]],[[0,0],[1,0]],[[0,1],[1,1]],[[1,0],[1,1]]],\
\cf6 'p'\cf2 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,0.5],[1,0.5]],[[1,0],[1,0.5]]],\
\cf6 'q'\cf2 :[[[0,0],[0,0.75]],[[0,0],[0.75,0]],[[0,0.75],[0.75,0.75]],[[0.75,0],[0.75,0.75]],[[0.5,0.5],[1,1]]],\
\cf6 'r'\cf2 :[[[0,0],[0,1]],[[0,0],[1,0]],[[0,0.5],[1,0.5]],[[1,0],[1,0.5]],[[0,0.5],[1,1]]],\
\cf6 's'\cf2 :[[[0,0],[0,0.5]],[[0,0],[1,0]],[[0,1],[1,1]],[[0,0.5],[1,0.5]],[[1,0.5],[1,1]]],\
\cf6 't'\cf2 :[[[0,0],[1,0]],[[0.5,0],[0.5,1]]],\
\cf6 'u'\cf2 :[[[0,1],[0,0]],[[0,1],[1,1]],[[1,0],[1,1]]],\
\cf6 'v'\cf2 :[[[0,0],[0.5,1]],[[0.5,1],[1,0]]],\
\cf6 'w'\cf2 :[[[0,0],[0.25,1]],[[0.25,1],[0.5,0.5]],[[0.5,0.5],[0.75,1]],[[0.75,1],[1,0]]],\
\cf6 'x'\cf2 :[[[0,0],[1,1]],[[0,1],[1,0]]],\
\cf6 'y'\cf2 :[[[0,0],[0.5,0.5]],[[0.5,0.5],[1,0]],[[0.5,0.5],[0.5,1]]],\
\cf6 'z'\cf2 :[[[0,1],[1,0]],[[0,0],[1,0]],[[0,1],[1,1]]],\
(\cf5 " "\cf2 .asSymbol):[[[0,1],[1,1]],[[0,0.8],[0,1]],[[1,0.8],[1,1]]]\
);\
\
w = \cf2 SCWindow\cf0 (\cf4 "welcome"\cf0 , \cf2 Rect\cf0 (40, 500, h, v));\
w.view.background = \cf2 Color\cf0 .blue(0.5);\
w.onClose = \{ run = \cf2 false\cf0 \};\
w = \cf3 GUI\cf2 .window.new(\cf5 "welcome"\cf2 , \cf3 Rect\cf2 (40, 500, h, v));\
w.view.background = \cf3 Color\cf2 .blue(0.5);\
w.onClose = \{ run = \cf3 false\cf2 \};\
w.front;\
\
drawletter=\{\cf2 arg\cf0 which, startx, starty, xscale=100, yscale,prop=1.0;\
\cf2 var\cf0 data;\
pen = \cf3 GUI\cf2 .pen;\
drawletter=\{\cf3 arg\cf2 which, startx, starty, xscale=100, yscale,prop=1.0;\
\cf3 var\cf2 data;\
\
yscale= yscale ? xscale;\
\
data= linetext[which];\
\
prop=(round((data.size)*prop).asInteger).max(1);\
\
prop.do(\{\cf2 arg\cf0 i;\
\cf2 var\cf0 val=data[i];\
prop.do(\{\cf3 arg\cf2 i;\
\cf3 var\cf2 val=data[i];\
\
\cf2 Pen\cf0 .beginPath;\
\cf2 Pen\cf0 .line(\cf2 Point\cf0 (startx+(xscale*val[0][0]),starty+(yscale*val[0][1])),\cf2 Point\cf0 (startx+(xscale*val[1][0]),starty+(yscale*val[1][1])));\
\cf2 Pen\cf0 .stroke;\
pen.beginPath;\
pen.line(\cf3 Point\cf2 (startx+(xscale*val[0][0]),starty+(yscale*val[0][1])),\cf3 Point\cf2 (startx+(xscale*val[1][0]),starty+(yscale*val[1][1])));\
pen.stroke;\
\
\});\
\
Expand All @@ -86,16 +87,16 @@ penwidth=rrand(2,3);\
\
w.drawHook = \{\
\
\cf2 Pen\cf0 .use \{\cf2 var\cf0 xoscil, xsizoscil,yoscil, todraw, usedtime;\
pen.use \{\cf3 var\cf2 xoscil, xsizoscil,yoscil, todraw, usedtime;\
\
\cf2 Pen\cf0 .width= penwidth;\
\cf2 Color\cf0 .yellow(yellowness).set;\
pen.width= penwidth;\
pen.color=\cf3 Color\cf2 .yellow(yellowness);\
\
usedtime=time.min(1.0);\
\
todraw=(round((name.size)*usedtime).asInteger).max(1);\
\
todraw.do(\{\cf2 arg\cf0 j;\
todraw.do(\{\cf3 arg\cf2 j;\
\
xoscil= sin(2*pi*time+(j*pi*0.13))*140/(1+(10*time));\
\
Expand All @@ -115,8 +116,8 @@ w.drawHook = \{\
\{ while \{ time<2.0 \} \{ \
\
w.refresh; \
time=(time+0.025); \cf3 //%2.0;\cf0 \
0.05.wait; \} \}.fork(\cf2 AppClock\cf0 )\
time=(time+0.025); \cf4 //%2.0;\cf2 \
0.05.wait; \} \}.fork(\cf3 AppClock\cf2 )\
\
)\
}
80 changes: 45 additions & 35 deletions build/examples/GUI examples/ScopeExample.rtf
@@ -1,62 +1,72 @@
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
{\fonttbl\f0\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;\red191\green0\blue0;\red0\green0\blue191;\red0\green115\blue0;
\red96\green96\blue96;}
{\colortbl;\red255\green255\blue255;\red191\green0\blue0;\red0\green0\blue0;\red0\green0\blue191;
\red0\green115\blue0;\red96\green96\blue96;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\fs18 \cf2 // thor magnusson (2007)\cf0 \
\f0\fs18 \cf2 // thor magnusson (2007)\cf3 \
\
\cf2 // Example showing how SCScope can be used in a UI\cf0 \
\cf2 // Example showing how SCScope can be used in a UI\cf3 \
\
\cf4 GUI\cf3 .cocoa; \cf2 // use Mac OS X native GUI\cf3 \
\cf4 GUI\cf3 .swing; \cf2 // use Java GUI\cf3 \
\
(\
s = \cf3 Server\cf0 .internal;\
s = \cf4 GUI\cf3 .stethoscope.defaultServer;\
s.waitForBoot(\{\
\cf3 var\cf0 sc;\
b = \cf3 Buffer\cf0 .alloc(s,2048,2);\
a = \cf3 SynthDef\cf0 (\cf4 \\scopeExample\cf0 , \{ \cf3 arg\cf0 freq=400, rate=2, amp=0.4, pan=0;\
\cf3 var\cf0 signal;\
signal = [\cf3 LFSaw\cf0 .ar(freq, 0, amp/2)*\cf3 SinOsc\cf0 .ar(rate), \
\cf3 Pulse\cf0 .ar( freq, 0.51, amp)*\cf3 SinOsc\cf0 .ar(rate)];\
signal = \cf3 Balance2\cf0 .ar(signal[0], signal[1], pan);\
\cf3 ScopeOut\cf0 .ar( signal, b);\
\cf3 Out\cf0 .ar(0, signal);\
\cf4 var\cf3 sc;\
b = \cf4 Buffer\cf3 .alloc(s,2048,2);\
a = \cf4 SynthDef\cf3 (\cf5 \\scopeExample\cf3 , \{ \cf4 arg\cf3 freq=400, rate=2, amp=0.4, pan=0;\
\cf4 var\cf3 signal, scope;\
signal = [\cf4 LFSaw\cf3 .ar(freq, 0, amp/2)*\cf4 SinOsc\cf3 .ar(rate), \
\cf4 Pulse\cf3 .ar( freq, 0.51, amp)*\cf4 SinOsc\cf3 .ar(rate)];\
signal = \cf4 Balance2\cf3 .ar(signal[0], signal[1], pan);\
scope = if( \cf4 GUI\cf3 .id === \cf5 \\cocoa\cf3 , \cf5 \\ScopeOut\cf3 , \cf5 \\JScopeOut\cf3 ).asClass;\
scope.ar( signal, b );\
\cf4 Out\cf3 .ar(0, signal);\
\}).play(s);\
\
w = \cf3 SCWindow\cf0 .new(\cf5 "scope in a gui"\cf0 , \cf3 Rect\cf0 (100, 400, 400, 300))\
.onClose_(\{a.free;\}) \cf2 // free synth on closing window\cf0 \
w = \cf4 GUI\cf3 .window.new(\cf6 "scope in a gui"\cf3 , \cf4 Rect\cf3 (100, 400, 400, 300))\
.onClose_(\{a.free;\}) \cf2 // free synth on closing window\cf3 \
.front;\
\
\cf3 SCMultiSliderView\cf0 (w, \cf3 Rect\cf0 (10, 10, 90, 120))\
\cf4 GUI\cf3 .multiSliderView.new(w, \cf4 Rect\cf3 (10, 10, 90, 120))\
.value_([0.4, 0.5, 0.6, 0.5])\
.indexIsHorizontal_(\cf3 false\cf0 )\
.isFilled_(\cf3 true\cf0 )\
.strokeColor_(\cf3 Color\cf0 .new255(10, 55, 10))\
.fillColor_(\cf3 Color\cf0 .new255(110, 155, 110).alpha_(0.6))\
.indexIsHorizontal_(\cf4 false\cf3 )\
.isFilled_(\cf4 true\cf3 )\
.strokeColor_(\cf4 Color\cf3 .new255(10, 55, 10))\
.fillColor_(\cf4 Color\cf3 .new255(110, 155, 110).alpha_(0.6))\
.indexThumbSize_(26)\
.gap_(4)\
.valueThumbSize_(1)\
.action_(\{\cf3 |sl|\cf0 \
.action_(\{\cf4 |sl|\cf3 \
sl.index.switch\
\{0\} \{ a.set(\cf4 \\freq\cf0 , 400+(sl.value[sl.index]*400)) \}\
\{1\} \{ a.set(\cf4 \\rate\cf0 , (sl.value[sl.index]*10)) \}\
\{2\} \{ a.set(\cf4 \\amp\cf0 , sl.value[sl.index]) \}\
\{3\} \{ a.set(\cf4 \\pan\cf0 , (sl.value[sl.index]*2)-1) \};\
\{0\} \{ a.set(\cf5 \\freq\cf3 , 400+(sl.value[sl.index]*400)) \}\
\{1\} \{ a.set(\cf5 \\rate\cf3 , (sl.value[sl.index]*10)) \}\
\{2\} \{ a.set(\cf5 \\amp\cf3 , sl.value[sl.index]) \}\
\{3\} \{ a.set(\cf5 \\pan\cf3 , (sl.value[sl.index]*2)-1) \};\
\});\
\
\cf3 SCStaticText\cf0 (w, \cf3 Rect\cf0 (10, 0, 90, 140))\
.string_(\cf5 " Freq \\n\\n Rate \\n\\n Amp \\n\\n Pan"\cf0 );\
\cf4 GUI\cf3 .staticText.new(w, \cf4 Rect\cf3 (14, 4, 90, 30))\
.string_(\cf6 "Freq"\cf3 );\
\cf4 GUI\cf3 .staticText.new(w, \cf4 Rect\cf3 (14, 34, 90, 30))\
.string_(\cf6 "Rate"\cf3 );\
\cf4 GUI\cf3 .staticText.new(w, \cf4 Rect\cf3 (14, 64, 90, 30))\
.string_(\cf6 "Amp"\cf3 );\
\cf4 GUI\cf3 .staticText.new(w, \cf4 Rect\cf3 (14, 94, 90, 30))\
.string_(\cf6 "Pan"\cf3 );\
\
\cf3 SCStaticText\cf0 (w, \cf3 Rect\cf0 (10, 140, 90, 16))\
.string_(\cf5 "xZoom:"\cf0 );\
\cf4 GUI\cf3 .staticText.new(w, \cf4 Rect\cf3 (10, 140, 90, 16))\
.string_(\cf6 "xZoom:"\cf3 );\
\
\cf3 SCSlider\cf0 (w, \cf3 Rect\cf0 (10, 160, 90, 16))\
.action_(\{\cf3 |sl|\cf0 sc.xZoom_(sl.value*4)\});\
\cf4 GUI\cf3 .slider.new(w, \cf4 Rect\cf3 (10, 160, 90, 24))\
.action_(\{\cf4 |sl|\cf3 sc.xZoom_(sl.value*4)\});\
\
sc = \cf3 SCScope\cf0 (w, \cf3 Rect\cf0 (120,10,260,260))\
sc = \cf4 GUI\cf3 .scopeView.new(w, \cf4 Rect\cf3 (120,10,260,260))\
.bufnum_(b.bufnum)\
.background_(\cf3 Color\cf0 .white)\
.background_(\cf4 Color\cf3 .white)\
.resize_(5)\
.waveColors_([\cf3 Color\cf0 .black, \cf3 Color\cf0 .black]);\
.waveColors_([\cf4 Color\cf3 .black, \cf4 Color\cf3 .black]);\
\});\
)\
\
Expand Down
61 changes: 31 additions & 30 deletions build/examples/GUI examples/TwoMultiSlidersInOne.rtf
@@ -1,63 +1,64 @@
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
{\fonttbl\f0\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;\red191\green0\blue0;\red0\green0\blue191;\red96\green96\blue96;
}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
{\colortbl;\red255\green255\blue255;\red0\green0\blue191;\red0\green0\blue0;\red191\green0\blue0;
\red96\green96\blue96;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural

\f0\fs18 \cf0 \
(\
\f0\fs18 \cf2 GUI\cf3 .cocoa; \cf4 // use CocoaGUI (Mac OS X native)\cf3 \
\cf2 GUI\cf3 .swing; \cf4 // use SwingGUI (Java based GUI)\cf3 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf2 //use as table\cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf3 var\cf0 size, win, data1, data2, view1, view2, swapData, data1Color, data2Color;\
data1Color = \cf3 Color\cf0 .blue;\
data2Color = \cf3 Color\cf0 .green;\
\cf3 \
(\
\cf4 //use as table\cf3 \
\cf2 var\cf3 size, win, data1, data2, view1, view2, swapData, data1Color, data2Color;\
data1Color = \cf2 Color\cf3 .blue;\
data2Color = \cf2 Color\cf3 .green;\
size = 350 / 6;\
data1 = \{1.0.rand\} ! size;\
data2 = \{1.0.rand\} ! size;\
\
win = \cf3 SCWindow\cf0 (\cf4 "double multislider"\cf0 , \cf3 Rect\cf0 (200 , 450, 450, 150));\
win = \cf2 GUI\cf3 .window.new(\cf5 "double multislider"\cf3 , \cf2 Rect\cf3 (200 , 450, 450, 150));\
\
\cf3 SCButton\cf0 (win, \cf3 Rect\cf0 (0,0, 80,20)).states_([[\cf4 "green"\cf0 ],[\cf4 "blue"\cf0 ]])\
.action_\{\cf3 |v|\cf0 swapData.(v.value)\};\
\cf2 GUI\cf3 .button.new(win, \cf2 Rect\cf3 (0,0, 80,20)).states_([[\cf5 "green"\cf3 ],[\cf5 "blue"\cf3 ]])\
.action_\{\cf2 |v|\cf3 swapData.(v.value)\};\
\
swapData = \{\cf3 |dofocusOn|\cf0 \
swapData = \{\cf2 |dofocusOn|\cf3 \
view1.remove;\
view2.remove;\
if(dofocusOn == 0)\{\
view1 = \cf3 SCMultiSliderView\cf0 (win, \cf3 Rect\cf0 (0, 24, 350, 100))\
.background_(\cf3 Color\cf0 .green(alpha:0.0))\
view1 = \cf2 GUI\cf3 .multiSliderView.new(win, \cf2 Rect\cf3 (0, 24, 350, 100))\
.background_(\cf2 Color\cf3 .green(alpha:0.0))\
.fillColor_(data1Color.alpha_(0.5))\
.value_(data1)\
.isFilled_(\cf3 true\cf0 )\
.isFilled_(\cf2 true\cf3 )\
.indexThumbSize_(2)\
.gap_(4)\
.action_(\{\cf3 |sl|\cf0 data1 = sl.value;\});\
view2 = \cf3 SCMultiSliderView\cf0 (win, \cf3 Rect\cf0 (0, 24, 350, 100))\
.background_(\cf3 Color\cf0 .green.alpha_(0.0))\
.action_(\{\cf2 |sl|\cf3 data1 = sl.value;\});\
view2 = \cf2 GUI\cf3 .multiSliderView.new(win, \cf2 Rect\cf3 (0, 24, 350, 100))\
.background_(\cf2 Color\cf3 .green.alpha_(0.0))\
.fillColor_(data2Color)\
.value_(data2)\
.isFilled_(\cf3 true\cf0 )\
.isFilled_(\cf2 true\cf3 )\
.indexThumbSize_(2)\
.gap_(4)\
.action_(\{\cf3 |sl|\cf0 data2 = sl.value;\});\
.action_(\{\cf2 |sl|\cf3 data2 = sl.value;\});\
\}\{\
view2 = \cf3 SCMultiSliderView\cf0 (win, \cf3 Rect\cf0 (0, 24, 350, 100))\
.background_(\cf3 Color\cf0 .green(alpha:0.0))\
view2 = \cf2 GUI\cf3 .multiSliderView.new(win, \cf2 Rect\cf3 (0, 24, 350, 100))\
.background_(\cf2 Color\cf3 .green(alpha:0.0))\
.fillColor_(data2Color.alpha_(0.5))\
.value_(data2)\
.isFilled_(\cf3 true\cf0 )\
.isFilled_(\cf2 true\cf3 )\
.indexThumbSize_(2)\
.gap_(4)\
.action_(\{\cf3 |sl|\cf0 data2 = sl.value;\});\
view1 = \cf3 SCMultiSliderView\cf0 (win, \cf3 Rect\cf0 (0, 24, 350, 100))\
.background_(\cf3 Color\cf0 .green.alpha_(0.0))\
.action_(\{\cf2 |sl|\cf3 data2 = sl.value;\});\
view1 = \cf2 GUI\cf3 .multiSliderView.new(win, \cf2 Rect\cf3 (0, 24, 350, 100))\
.background_(\cf2 Color\cf3 .green.alpha_(0.0))\
.fillColor_(data1Color) \
.value_(data1)\
.isFilled_(\cf3 true\cf0 )\
.isFilled_(\cf2 true\cf3 )\
.indexThumbSize_(2)\
.gap_(4)\
.action_(\{\cf3 |sl|\cf0 data1 = sl.value;\});\
.action_(\{\cf2 |sl|\cf3 data1 = sl.value;\});\
\}\
\
\};\
Expand Down
2 changes: 1 addition & 1 deletion build/examples/GUI examples/rotary hommage duchamp.scd
Expand Up @@ -25,7 +25,7 @@
c = sin(z * 0.005);
bounds = bounds.insetBy(i, i);
bb = bounds.moveBy(13 * a, 13 * b);
colors.wrapAt(i).set;
GUI.pen.color=colors.wrapAt(i);
GUI.pen.width = 30.rand;
fillOrStroke.wrapAt(i).value(bb);
};
Expand Down

0 comments on commit 6dadbd4

Please sign in to comment.