[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: quarks:[1298] wslib
Revision: 1298
http://quarks.svn.sourceforge.net/quarks/?rev=1298&view=rev
Author: wsnoei
Date: 2009-12-19 12:40:27 +0000 (Sat, 19 Dec 2009)
Log Message:
-----------
small updates wslib 4
Modified Paths:
--------------
wslib/wslib-classes/Experimental/SSHServer.sc
wslib/wslib-classes/Extensions/String/asStringWithFrac.sc
wslib/wslib-classes/GUI/Drawing/extPen-roundedRect.sc
wslib/wslib-classes/GUI/Drawing/extPen-transformToRect.sc
wslib/wslib-classes/GUI/ScaledUserView/ScaledUserView.sc
wslib/wslib-classes/GUI/ScaledUserView/ScaledUserViewWindow.sc
wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundButton.sc
wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundNumberBox.sc
wslib/wslib-classes/GUI/osx/scide_scapp/Views/SmoothSlider.sc
wslib/wslib-help/ScaledUserViewWindow.html
wslib/wslib-help/SmoothSlider.html
Added Paths:
-----------
wslib/wslib-classes/Extensions/Server/extServer-bootInTerminal.sc
wslib/wslib-classes/Extensions/Various/EnvWarp.sc
wslib/wslib-classes/Extensions/Various/extNumber-!-.sc
wslib/wslib-classes/Lang/osx/scide_scapp/
wslib/wslib-classes/Lang/osx/scide_scapp/extSCWindow-decorate.sc
Removed Paths:
-------------
wslib/wslib-classes/Lang/osx/Shorcuts/
Modified: wslib/wslib-classes/Experimental/SSHServer.sc
===================================================================
--- wslib/wslib-classes/Experimental/SSHServer.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/Experimental/SSHServer.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -13,6 +13,7 @@
*new { arg name, addr, options, clientID=0, sshLogin;
^super.new(name, addr, options, clientID)
.isLocal_( true ) // act as local server
+ .remoteControlled_( true )
.sshLogin_( sshLogin );
}
Added: wslib/wslib-classes/Extensions/Server/extServer-bootInTerminal.sc
===================================================================
--- wslib/wslib-classes/Extensions/Server/extServer-bootInTerminal.sc (rev 0)
+++ wslib/wslib-classes/Extensions/Server/extServer-bootInTerminal.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -0,0 +1,31 @@
++ Server {
+
+ bootInTerminal {
+ if (inProcess, { // not in terminal
+ "booting internal : not in Terminal".inform;
+ this.bootInProcess;
+ pid = thisProcess.pid;
+ },{
+ (
+ "echo ' '; echo booting " ++ addr.port.asString ++ "; echo ' ' ;" ++
+ program ++ options.asOptionsString(addr.port)).runInTerminal;
+ ("booting " ++ addr.port.asString ++ " in Terminal").inform;
+ });
+ }
+
+ }
+
++ SSHServer {
+
+ bootInTerminal {
+ if (inProcess, {
+ "booting internal".inform;
+ this.bootInProcess;
+ },{ runInTerminal( "ssh" + this.sshFullLogin.quote +
+ "'cd" + scDirRemote.quote + ";" +
+ "./scsynth" ++ options.asOptionsString(addr.port) + "'");
+ ("booting " ++ addr.port.asString ++ "in Terminal").inform;
+ });
+ }
+
+ }
\ No newline at end of file
Modified: wslib/wslib-classes/Extensions/String/asStringWithFrac.sc
===================================================================
--- wslib/wslib-classes/Extensions/String/asStringWithFrac.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/Extensions/String/asStringWithFrac.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -6,11 +6,11 @@
+ Float {
asStringWithFrac { |fracSize = 3|
- ^(this.floor.asString ++ "." ++
- (this.frac * (10**fracSize) ).round(1).asInt.asStringToBase(10,fracSize));
+ ^(["-", "", ""][ this.sign + 1 ] ++ this.abs.floor.asString ++ "." ++
+ ( this.abs.frac* (10**fracSize) ).round(1).asInt.asStringToBase(10,fracSize));
}
}
+ ArrayedCollection {
- preExtend { |size, item| ^this.reverse.extend( size, item ).reverse }
+ preExtend { |size, item| ^this.reverse.extend( size, item ).reverse } // optimize?
}
\ No newline at end of file
Added: wslib/wslib-classes/Extensions/Various/EnvWarp.sc
===================================================================
--- wslib/wslib-classes/Extensions/Various/EnvWarp.sc (rev 0)
+++ wslib/wslib-classes/Extensions/Various/EnvWarp.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -0,0 +1,137 @@
+EnvWarp : Warp {
+
+ /*
+ segmented Warp
+ creates an env inside if not provided with one
+
+ // fold in the center:
+ x = EnvWarp([0,1,0]);
+ x.map( 0.5 ); // -> 1
+ x.map( [0,1] ); // -> [0,0]
+ x.map( 0.25 ); // -> 0.5
+
+ // frequency with fixed center (440)
+ x = EnvWarp([[20,0,\exp], [440,0.5,\exp], [22050,1]]);
+ x.map( 0.5 ); // -> 440
+ x.map( [0,1] ); // -> [20,22050]
+ x.map( 0.25 ); // -> 0.5
+ x.unmap( 220 ); // -> 0.38787808789121
+ x.unmap( 880 ); // -> 0.58854052996238
+ x.env.plot;
+
+ // user Env
+ x = EnvWarp( Env([0,1,1,0], [0.3,0.4,0.3]) );
+ x.map( 0.5 );
+ */
+
+
+ var <>env, <array;
+ var <last = 0;
+
+ classvar <warpConversionTable;
+
+ *initClass {
+ warpConversionTable =
+ IdentityDictionary[
+ \lin -> \lin,
+ \linear -> \lin,
+ \exp -> \exp,
+ \exponential -> \exp,
+ \sin -> \cos, // strange but true ..
+ \sine -> \cos,
+ \wel -> \sin,
+ \welch -> \sin,
+
+ // TODO
+ \sqr -> \lin,
+ \squared -> \lin,
+ \cub -> \lin,
+ \cubed -> \lin
+ ];
+ }
+
+ *new { |array|
+ ^super.newCopyArgs.init( array );
+ }
+
+ init { |inArray|
+ if( inArray.class == Env )
+ { env = inArray; array = this.class.arrayFromEnv( env ); }
+ { this.makeEnv( inArray ); }
+ }
+
+ makeEnv { |inArray|
+ array = this.class.cleanArray( inArray );
+ env = Env.new( array.flop[0], array.flop[1].differentiate[1..], array.flop[2] );
+ }
+
+
+ *cleanArray { |inArray|
+
+ /*
+ cleans an array into the form:
+ [ [ level, time, curve ], etc.. ]
+ input array can also hold single levels, which get times scaled between 0 and 1
+ first time always becomes 0, last time is always 1
+ times are sorted
+
+ EnvWarp.cleanArray( [0,1] );
+ -> [ [ 0, 0, lin ], [ 1, 1, lin ] ]
+
+ EnvWarp.cleanArray( [[0.5,0.75],[1,0.25]] );
+ -> [ [ 0.5, 0, step ], [ 0.5, 0.75, lin ], [ 1, 0.25, lin ], [ 1, 1, step ] ]
+ */
+
+ inArray = inArray ? [0,1];
+
+ inArray = inArray.collect({ |item,i|
+ if( item.size <= 1 )
+ { item.asCollection ++ [ i / (inArray.size-1), \lin ]; }
+ { item };
+ });
+
+ inArray = inArray.sort( _[1] <= _[1] );
+
+ if( inArray[0][1] != 0 ) { inArray = inArray.addFirst( [ inArray[0][0], 0, \step ] ) };
+ if( inArray.last[1] < 1 ) { inArray = inArray.add( [ inArray.last[0], 1, \step ] ) };
+
+ ^inArray.collect({ |item| [item[0], item[1], item[2] ? \lin ] });
+ }
+
+
+ *arrayFromEnv { |env|
+ ^[env.levels, ([0] ++ env.times).integrate, env.curves ? \lin].flop;
+ }
+
+ map { arg value; // can be array
+ ^if( value.size > 0 ) { value.collect( env.at( _ ) ) } { env.at( value ) };
+ }
+
+ unmap { arg value; // finds first occurence, returns previous value if not found (default 0)
+ var node, nextNode;
+
+ node = array.detectIndex({ |item,i|
+ value.inclusivelyBetween( *[item[0], (array[i+1] ? item)[0]].sort );
+ });
+
+ if( node.notNil )
+ {
+ nextNode = array[node + 1];
+ node = array[node];
+ if( nextNode.isNil or: { node[2] == 'step'} )
+ { ^last = node[1] }
+ { ^last = node[1].blend( nextNode[1], [ node[0], nextNode[0],
+ if( node[2].isNumber )
+ { node[2] }
+ { warpConversionTable[ node[2] ] }
+ ].asSpec.unmap( value ) );
+ }
+ }
+ { ^last };
+ }
+ }
+
++ Env {
+ asWarp { ^EnvWarp( this ); }
+ }
+
Added: wslib/wslib-classes/Extensions/Various/extNumber-!-.sc
===================================================================
--- wslib/wslib-classes/Extensions/Various/extNumber-!-.sc (rev 0)
+++ wslib/wslib-classes/Extensions/Various/extNumber-!-.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -0,0 +1,9 @@
+// wslib 2009
+// reversed '-' and '/'
+//
+// (a !- b) == (b - a)
+
++ Object {
+ !- { arg aNumber, adverb; ^aNumber.perform( '-', this, adverb ) }
+ !/ { arg aNumber, adverb; ^aNumber.perform( '/', this, adverb ) }
+ }
Modified: wslib/wslib-classes/GUI/Drawing/extPen-roundedRect.sc
===================================================================
--- wslib/wslib-classes/GUI/Drawing/extPen-roundedRect.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/Drawing/extPen-roundedRect.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -14,9 +14,24 @@
{
radius = radius.asCollection.collect({ |item|
item ?? { rect.width.min( rect.height ) / 2; }; });
+
+ // auto scale radius if too large
+ if ( radius.size == 1 )
+ { radius = min( radius, min( rect.width, rect.height ) / 2 ) }
+ { if( ((radius@@0) + (radius@@3)) > rect.height )
+ { radius = radius * ( rect.height / ((radius@@0) + (radius@@3))); };
+ if( ((radius@@1) + (radius@@2)) > rect.height )
+ { radius = radius * ( rect.height / ((radius@@1) + (radius@@2))); };
+ if( ((radius@@0) + (radius@@1)) > rect.width )
+ { radius = radius * ( rect.width / ((radius@@0) + (radius@@1))); };
+ if( ((radius@@2) + (radius@@3)) > rect.width )
+ { radius = radius * ( rect.width / ((radius@@2) + (radius@@3))); };
+ };
- case { GUI.pen.respondsTo( \arcTo ) }
- // after rev7947 (redfrik added Meta_Pen:arcTo)
+
+ case { GUI.pen.respondsTo( \arcTo ) } // after rev7947 (redfrik added Meta_Pen:arcTo)
+ // also for swingosc now
+
{
points = [rect.rightTop, rect.rightBottom,rect.leftBottom, rect.leftTop];
lastPoint = points.last;
@@ -72,6 +87,20 @@
radius = radius.collect({ |item|
item ?? { rect.width.min( rect.height ) / 2; };
});
+
+ // auto scale radius if too large
+ if ( radius.size == 1 )
+ { radius = min( radius, min( rect.width, rect.height ) / 2 ) }
+ { if( ((radius@@0) + (radius@@3)) > rect.height )
+ { radius = radius * ( rect.height / ((radius@@0) + (radius@@3))); };
+ if( ((radius@@1) + (radius@@2)) > rect.height )
+ { radius = radius * ( rect.height / ((radius@@1) + (radius@@2))); };
+ if( ((radius@@0) + (radius@@1)) > rect.width )
+ { radius = radius * ( rect.width / ((radius@@0) + (radius@@1))); };
+ if( ((radius@@2) + (radius@@3)) > rect.width )
+ { radius = radius * ( rect.width / ((radius@@2) + (radius@@3))); };
+ };
+
//angle = angle.asCollection;
Modified: wslib/wslib-classes/GUI/Drawing/extPen-transformToRect.sc
===================================================================
--- wslib/wslib-classes/GUI/Drawing/extPen-transformToRect.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/Drawing/extPen-transformToRect.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -1,8 +1,9 @@
+ Pen {
- *transformToRect {|rect, fromRect|
+ *transformToRect {|rect, fromRect, keepRatio = false, scale = 1, move = 0.5|
var scaleAmt;
rect = rect ?? {Rect(0,0,400,400)};
fromRect = fromRect ? rect;
+ rect = fromRect.scaleCenteredIn( rect, keepRatio, scale, move );
scaleAmt = (rect.extent/fromRect.extent).asArray;
Pen.translate( *(fromRect.origin.asArray.neg * scaleAmt) + rect.origin.asArray );
^Pen.scale( *scaleAmt );
@@ -10,9 +11,59 @@
}
+ Point {
- transformToRect {|rect, fromRect|
+
+ transformToRect {|rect, fromRect, keepRatio = false, scale = 1, move = 0.5|
rect = rect ?? {Rect(0,0,400,400)};
fromRect = fromRect ? rect;
+ rect = fromRect.scaleCenteredIn( rect, keepRatio, scale, move );
^((this - fromRect.origin) * ( rect.extent/fromRect.extent )) + rect.origin;
}
+
+ transformFromRect {|rect, fromRect, keepRatio = false, scale = 1, move = 0.5|
+ rect = rect ?? {Rect(0,0,400,400)};
+ fromRect = fromRect ? rect;
+ rect = fromRect.scaleCenteredIn( rect, keepRatio, scale, move );
+ ^((this - rect.origin) * ( fromRect.extent/rect.extent )) + fromRect.origin;
+ }
+ }
+
++ Rect {
+ scaleCenteredIn { |toRect, keepRatio = true, ratio = 1, move = 0.5|
+ var xyr, rect, spacing;
+
+ move = move.asPoint;
+ ratio = ratio.asPoint;
+
+ toRect = (toRect ? this).asRect;
+
+ if( keepRatio )
+ {
+ xyr = width/height;
+
+ if( (toRect.width / toRect.height).abs < xyr.abs )
+ { rect = Rect(0,0, toRect.width * ratio.x , (toRect.width / xyr) * ratio.y ); }
+ { rect = Rect(0,0, toRect.height * xyr * ratio.x, toRect.height * ratio.y ); };
+ }
+ { rect = Rect(0,0, toRect.width * ratio.x, toRect.height * ratio.y) };
+
+ spacing = (toRect.extent - rect.extent) * move;
+ rect.origin = toRect.origin - rect.origin + spacing;
+
+ //rect.origin = rect.centerIn( toRect );
+ ^rect;
+ }
+
+ transformToRect { |rect, fromRect, keepRatio = true, ratio = 1, move = 0.5|
+ rect = rect ?? {Rect(0,0,400,400)};
+ fromRect = fromRect ? this;
+ ^this.class.fromPoints( *[ this.leftTop, this.rightBottom ]
+ .collect( _.transformToRect( rect, fromRect, keepRatio, ratio, move ) ) );
+ }
+
+ transformFromRect { |rect, fromRect, keepRatio = true, ratio = 1, move = 0.5|
+ rect = rect ?? {Rect(0,0,400,400)};
+ fromRect = fromRect ? this;
+ ^this.class.fromPoints( *[ this.leftTop, this.rightBottom ]
+ .collect( _.transformFromRect( rect, fromRect, keepRatio, ratio, move ) ) );
+ }
}
\ No newline at end of file
Modified: wslib/wslib-classes/GUI/ScaledUserView/ScaledUserView.sc
===================================================================
--- wslib/wslib-classes/GUI/ScaledUserView/ScaledUserView.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/ScaledUserView/ScaledUserView.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -2,7 +2,10 @@
// scaled SCUserView
// 2007: altered for SC3.2 compatibility
+// 2009: altered for SwingOsc compatibility
+// TODO: correct half pixel problem for mouse feedback
+
ScaledUserView {
classvar <>gridColor;
@@ -13,12 +16,19 @@
var <>gridMode = \blocks;
var <>mouseDownAction, <>mouseMoveAction, <>mouseUpAction;
var <>mouseOutOfBoundsAction;
- var <drawFunc, <unscaledDrawFunc, <unclippedUnscaledDrawFunc, <beforeDrawFunc;
+ var <drawFunc, <unscaledDrawFunc, <beforeDrawFunc;
+ var unclippedUnscaledDrawFunc; // depricated
var <>autoRefresh = true;
var <>autoRefreshMouseActions = true;
+
+ var <>refreshAction;
+
+ // clip: no effect anymore since SC3.3
+ // still here for backwards compat
var <clip = true;
var <>clipScaled = true; // clips only when clip is also true
var <>clipUnscaled = true;
+
var <background;
var <>keepRatio = false; // experimental - handle with care..
@@ -39,14 +49,26 @@
*window { |name, bounds, fromBounds, viewOffset|
// creates a window with sliders for scale/move
- ^ScaledUserViewWindow( name, bounds, fromBounds, viewOffset );
+ ^ScaledUserViewContainer( name, bounds, fromBounds, viewOffset );
}
+
+ *withSliders { |window, bounds, fromBounds|
+ ^ScaledUserViewContainer( window, bounds, fromBounds );
+ }
init { |window, bounds|
- view = GUI.userView.new( window, bounds );
+ view = UserView( window, bounds );
//view.relativeOrigin_( false );
view.background = background;
+ if( view.respondsTo( \drawBounds ).not ) // dirty - but it does the trick..
+ { view.addUniqueMethod( \drawBounds, { |vw|
+ if ( vw.relativeOrigin ) // thanks JostM !
+ { vw.bounds.moveTo(0,0) }
+ { vw.absoluteBounds; };
+ })
+ };
+
view.mouseDownAction = { |v, x, y, m|
var scaledX, scaledY, isInside = true;
x = x - v.drawBounds.left; y = y - v.drawBounds.top;
@@ -81,6 +103,7 @@
var scaledViewBounds;
var viewRect;
+ var scaleAmt;
viewRect = this.viewRect;
@@ -88,18 +111,38 @@
if( background.class == Color )
{ Pen.use({
- background.set;
- Pen.fillRect( v.bounds );
+ Pen.color = background;
+ Pen.fillRect( v.drawBounds );
});
};
+
+
+ // move to views leftTop corner (only when relativeOrigin==false) :
+ Pen.translate( v.drawBounds.left, v.drawBounds.top );
+
+
+ if( clip ) { // swing will need clip
+ Pen.moveTo(0@0);
+ Pen.lineTo(v.drawBounds.width@0);
+ Pen.lineTo(v.drawBounds.width@xxxxxxxxxxxxxxxxxxx);
+ Pen.lineTo(0@xxxxxxxxxxxxxxxxxxx);
+ Pen.lineTo(0@0);
+ Pen.clip;
+ };
+
+
Pen.use({
- Pen.translate( v.drawBounds.left, v.drawBounds.top ); // move to views leftTop corner
-
- Pen.scale( *this.scaleAmt );
+ scaleAmt = this.scaleAmt;
+ Pen.scale( *scaleAmt );
+
+ if( GUI.scheme.id == 'swing' && {(scaleAmt[0] != scaleAmt[1])} )
+ { Pen.translate( 0.5, 0.5 ); }; // temp correction for swingosc half-pixel bug
+
Pen.translate( *this.moveAmt );
+ /*
// clip:
if( clip && clipScaled ) {
@@ -117,49 +160,56 @@
Pen.clip;
};
+ */
// grid:
if( (gridSpacingV != 0) && // kill grid if spacing < 2px
- { (viewRect.height / v.drawBounds.height) < ( gridSpacingV / 2 ) } )
- { if( gridMode.asCollection.wrapAt( 0 ) === 'blocks' )
- { gridColor.set;
- Pen.width = gridSpacingV;
- ((0, (gridSpacingV * 2) .. fromBounds.height + gridSpacingV)
- + (gridSpacingV / 2))
- .abs
- .do({ |item| Pen.line( 0@item, (fromBounds.width)@item ); });
- } { Color.black.blend( gridColor, 0.5 ).set;
- Pen.width = (fromBounds.width / v.drawBounds.width).abs / scaleV;
+ { (viewRect.height / v.drawBounds.height) < ( gridSpacingV / 2 ) } )
+ { if( gridMode.asCollection.wrapAt( 0 ) === 'blocks' )
+
+ { Pen.color = gridColor;
+ Pen.width = gridSpacingV;
+
+ ((0, (gridSpacingV * 2) .. fromBounds.height + gridSpacingV)
+ + (gridSpacingV / 2))
+ .abs
+ .do({ |item| Pen.line( 0@item, (fromBounds.width)@item ); });
+ }
+ { Pen.color = Color.black.blend( gridColor, 0.5 );
+ Pen.width = (fromBounds.width / v.drawBounds.width).abs / scaleV;
+
+ (0, gridSpacingV .. (fromBounds.height + gridSpacingV))
+ .abs
+ .do({ |item| Pen.line( 0@item, (fromBounds.width)@item ); });
+ };
- (0, gridSpacingV .. (fromBounds.height + gridSpacingV))
- .abs
- .do({ |item| Pen.line( 0@item, (fromBounds.width)@item ); });
- };
-
- Pen.stroke;
- };
+ Pen.stroke;
+ };
if( ( gridSpacingH != 0 ) &&
- { (viewRect.width / v.drawBounds.width) < (gridSpacingH / 2 ) } )
- { if( gridMode.asCollection.wrapAt( 1 ) === 'blocks' )
- { gridColor.set;
- Pen.width = gridSpacingH;
- ((0, (gridSpacingH * 2) .. fromBounds.width + gridSpacingH)
- + (gridSpacingH / 2))
- .abs
- .do({ |item| Pen.line( item@0, item@(fromBounds.height) ); });
- } { Color.black.blend( gridColor, 0.5 ).set;
- Pen.width = (fromBounds.width / v.drawBounds.width).abs / scaleH;
- (0, gridSpacingH .. (fromBounds.width + gridSpacingH))
- .abs
- .do({ |item| Pen.line( item@0, item@(fromBounds.height) ); });
- };
+ { (viewRect.width / v.drawBounds.width) < (gridSpacingH / 2 ) } )
+ { if( gridMode.asCollection.wrapAt( 1 ) === 'blocks' )
+ { Pen.color = gridColor;
+ Pen.width = gridSpacingH;
+
+ ((0, (gridSpacingH * 2) .. fromBounds.width + gridSpacingH)
+ + (gridSpacingH / 2))
+ .abs
+ .do({ |item| Pen.line( item@0, item@(fromBounds.height) ); });
+ }
+ { Pen.color = Color.black.blend( gridColor, 0.5 );
+ Pen.width = (fromBounds.width / v.drawBounds.width).abs / scaleH;
+
+ (0, gridSpacingH .. (fromBounds.width + gridSpacingH))
+ .abs
+ .do({ |item| Pen.line( item@0, item@(fromBounds.height) ); });
+ };
+
+ Pen.stroke;
+ };
- Pen.stroke;
- };
-
// drawFunc:
// line will be 1px at current view width and scale == [1,1]
@@ -167,39 +217,29 @@
[ (fromBounds.width / v.drawBounds.width).abs,
(fromBounds.height / v.drawBounds.height).abs ].mean;
- Color.black.set;
+ Pen.color = Color.black; // back to default
drawFunc.value( this );
});
-
- Pen.use({
- Pen.translate( v.drawBounds.left, v.drawBounds.top ); // move to views leftTop corner
- // clip unscaled:
- if( clip ) {
- Pen.moveTo(0@0);
- Pen.lineTo(v.drawBounds.width@0);
- Pen.lineTo(v.drawBounds.width@xxxxxxxxxxxxxxxxxxx);
- Pen.lineTo(0@xxxxxxxxxxxxxxxxxxx);
- Pen.lineTo(0@0);
- Pen.clip;
- };
-
+ Pen.use({
unscaledDrawFunc.value( this );
+ unclippedUnscaledDrawFunc.value( this ); // depricated
});
- Pen.use({
- Pen.translate( v.drawBounds.left, v.drawBounds.top ); // move to views leftTop corner
- unclippedUnscaledDrawFunc.value( this );
- });
+ refreshAction.value( this );
};
}
refresh { |flag = true|
flag = flag ? autoRefresh;
- if( flag == true ) { view.parent.refresh; }; }
+ if( flag == true ) {
+ view.refresh;
+ // refreshAction.value( this ); // won't work since this isn't the actual view
+ };
+ }
scaleH_ { |newScaleH, refreshFlag|
@@ -290,8 +330,13 @@
}
unclippedUnscaledDrawFunc_ { |newDrawFunc, refreshFlag|
+ this.deprecated(thisMethod);
unclippedUnscaledDrawFunc = newDrawFunc; this.refresh( refreshFlag );
}
+
+ unclippedUnscaledDrawFunc {
+ this.deprecated(thisMethod); ^unclippedUnscaledDrawFunc;
+ }
beforeDrawFunc_ { |newDrawFunc, refreshFlag|
beforeDrawFunc = newDrawFunc; this.refresh( refreshFlag );
Modified: wslib/wslib-classes/GUI/ScaledUserView/ScaledUserViewWindow.sc
===================================================================
--- wslib/wslib-classes/GUI/ScaledUserView/ScaledUserViewWindow.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/ScaledUserView/ScaledUserViewWindow.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -1,6 +1,339 @@
// wslib 2006
// scaled SCUserView
+// wslib 2009
+// scaled SCUserViewContainer
+// replacement for ScaledUserViewWindow
+// can both be a separate window and a compositeview in an existing window
+
+ScaledUserViewContainer {
+
+ classvar <>defaultBounds, <>defaultFromBounds;
+
+ var <composite, <userView, <scaleSliders, <moveSliders;
+ var <viewOffset;
+ var <>maxZoom = 8, <>minZoom = 1;
+ var resize = 1;
+ var window;
+ var currentBounds;
+ var <sliderKnobColor, <sliderBackColor;
+
+ var <sliderWidth = 12, <sliderSpacing = 2, <scaleSliderLength = 52; // defaults
+
+ // these defaults should not be changed until after creation
+ var <scaleHEnabled = true, <scaleVEnabled = true;
+ var <moveHEnabled = true, <moveVEnabled = true;
+
+ *initClass {
+ defaultBounds = Rect( 0, 0, 400, 400 );
+ defaultFromBounds = Rect(0,0,1,1); // different from ScaledUserView
+ }
+
+ doesNotUnderstand { arg selector ... args;
+ var res;
+ res = userView.perform(selector, *args);
+ if (res.class == ScaledUserView )
+ { ^this }
+ { ^res }
+ }
+
+ *new { |parent, bounds, fromBounds, viewOffset|
+ var resize;
+
+ viewOffset = viewOffset ? [1,1];
+ case { viewOffset.class == Point }
+ { viewOffset = [ viewOffset.x, viewOffset.y ]; }
+ { viewOffset.size == 0 }
+ { viewOffset = [ viewOffset, viewOffset ]; }
+ { viewOffset.size == 1 }
+ { viewOffset = viewOffset ++ viewOffset; };
+
+ if( parent.isNil or: {parent.isString} )
+ {
+ parent = Window(parent ? "ScaledUserView", bounds).front;
+ resize = 5;
+ bounds = (bounds ? defaultBounds).asRect;
+ bounds !? { bounds = bounds
+ .moveTo(*viewOffset)
+ .resizeBy(*viewOffset.neg)
+ .resizeBy(-2,-2) };
+ };
+
+ bounds = (bounds ? defaultBounds).asRect;
+ fromBounds = (fromBounds ? defaultFromBounds).asRect;
+ ^super.new.init( parent, bounds, fromBounds, resize);
+ }
+
+ front { composite.front }
+
+ init { | inParent, inBounds, inFromBounds, inResize|
+ resize = inResize ? resize;
+
+ sliderKnobColor = sliderKnobColor ?? { Color.gray(0.2); };
+ sliderBackColor = sliderBackColor ?? { Color.black.alpha_(0.33); };
+ composite = CompositeView( inParent, inBounds );
+ composite.resize_( resize );
+ // composite.background = Color.gray(0.8);
+ // composite.onClose = { onClose.value( this, composite ) };
+
+ userView = ScaledUserView( composite, Rect(0,0,
+ composite.bounds.width - (sliderWidth + sliderSpacing),
+ composite.bounds.height - (sliderWidth + sliderSpacing)), inFromBounds );
+
+ userView.view.resize_(5);
+ userView.view.focusColor = Color.clear;
+ userView.background = Color.white.alpha_(0.5);
+
+ scaleSliders = [
+ SmoothSlider( composite, Rect(
+ composite.bounds.width -
+ (scaleSliderLength + sliderWidth + sliderSpacing),
+ composite.bounds.height - sliderWidth,
+ scaleSliderLength, sliderWidth ) )
+ .value_(0).action_({ |v|
+ userView.scaleH =
+ v.value.linlin(0,1,minZoom.asPoint.x, maxZoom.asPoint.x);
+ //1 + (v.value * maxZoom.asPoint.x);
+ this.setMoveSliderWidths( composite.bounds );
+ })
+ .knobColor_( sliderKnobColor )
+ .hilightColor_( nil )
+ .background_(sliderBackColor)
+ .knobSize_( 1 )
+ .canFocus_( false )
+ .resize_(9),
+ SmoothSlider( composite, Rect(
+ composite.bounds.width - sliderWidth,
+ composite.bounds.height -
+ (scaleSliderLength + sliderWidth + sliderSpacing),
+ sliderWidth, scaleSliderLength ) )
+ .value_(1).action_({ |v|
+ userView.scaleV =
+ (1-v.value).linlin(0,1,minZoom.asPoint.y, maxZoom.asPoint.y);
+ //1 + ((1 - v.value) * maxZoom.asPoint.y);
+ this.setMoveSliderWidths( composite.bounds );
+ })
+ .knobColor_( sliderKnobColor )
+ .hilightColor_( nil )
+ .background_(sliderBackColor)
+ .knobSize_( 1 )
+ .canFocus_( false )
+ .resize_(9) ];
+
+ moveSliders = [
+ SmoothSlider( composite, Rect( 0,
+ composite.bounds.height - sliderWidth,
+ composite.bounds.width -
+ (scaleSliderLength + sliderWidth + (2 * sliderSpacing)),
+ sliderWidth ) )
+ .value_(0.5).action_({ |v| userView.moveH = v.value; })
+ .knobColor_( sliderKnobColor)
+ .hilightColor_( nil )
+ .background_(sliderBackColor)
+ .resize_(8)
+ .canFocus_( false ),
+ SmoothSlider( composite, Rect(
+ composite.bounds.width - sliderWidth,
+ 0, sliderWidth,
+ (composite.bounds.height -
+ (scaleSliderLength + sliderWidth + (2 * sliderSpacing))) ) )
+ .value_(0.5).action_({ |v| userView.moveV = 1 - (v.value); })
+ .knobColor_( sliderKnobColor )
+ .hilightColor_( nil )
+ .background_(sliderBackColor)
+ .resize_(6)
+ .canFocus_( false ) ];
+
+ this.setMoveSliderWidths;
+
+ currentBounds = userView.bounds;
+
+ userView.refreshAction = { |vw|
+ if( currentBounds != vw.bounds )
+ { this.setMoveSliderWidths; currentBounds = vw.bounds; }
+ };
+ }
+
+ updateSliders { |scaleFlag = true, moveFlag = true|
+ if( scaleFlag )
+ { scaleSliders[0].value =
+ userView.scaleH.linlin(minZoom.asPoint.x, maxZoom.asPoint.x, 0, 1 );
+ //(userView.scaleH - 1) / maxZoom.asPoint.x;
+ scaleSliders[1].value = 1 -
+ userView.scaleV.linlin(minZoom.asPoint.y, maxZoom.asPoint.y, 0, 1 );
+ //((userView.scaleV - 1) / maxZoom.asPoint.y );
+ this.setMoveSliderWidths;
+ };
+ if( moveFlag )
+ {
+ moveSliders[0].value = userView.moveH;
+ moveSliders[1].value = 1 - userView.moveV;
+ };
+ }
+
+ updateSliderBounds {
+
+ var hasH, hasV;
+
+ // show/hide sliders
+ [scaleHEnabled, scaleVEnabled, moveHEnabled, moveVEnabled].do({ |enabled, i|
+ [ scaleSliders[0], scaleSliders[1], moveSliders[0], moveSliders[1] ][i]
+ .visible = enabled;
+ });
+
+ if( scaleVEnabled ) { scaleSliders[1].visible = userView.keepRatio.not; };
+
+ hasH = (moveSliders[0].visible or: { scaleSliders[0].visible }).binaryValue;
+ hasV = (moveSliders[1].visible or: { scaleSliders[1].visible }).binaryValue;
+
+ #hasH, hasV = [ hasH, hasV ] * (sliderWidth + sliderSpacing);
+
+ // set bounds
+ if( moveSliders[0].visible )
+ { moveSliders[0].bounds = Rect(
+ 0,
+ composite.bounds.height - sliderWidth,
+ composite.bounds.width - ( hasV +
+ ((scaleSliderLength + sliderSpacing) * scaleSliders[0].visible.binaryValue )
+ ),
+ sliderWidth );
+ };
+
+ if( moveSliders[1].visible )
+ { moveSliders[1].bounds = Rect(
+ composite.bounds.width - sliderWidth,
+ 0,
+ sliderWidth,
+ composite.bounds.height - (hasH +
+ ((scaleSliderLength + sliderSpacing) * scaleSliders[1].visible.binaryValue )
+ )
+
+ );
+ };
+
+ if( scaleSliders[0].visible )
+ { scaleSliders[0].bounds = Rect(
+ composite.bounds.width - (scaleSliderLength + hasV),
+ composite.bounds.height - sliderWidth,
+ scaleSliderLength,
+ sliderWidth );
+ };
+
+ if( scaleSliders[1].visible )
+ { scaleSliders[1].bounds = Rect(
+ composite.bounds.width - sliderWidth,
+ composite.bounds.height - (scaleSliderLength + hasH),
+ sliderWidth,
+ scaleSliderLength );
+ };
+
+ userView.bounds = Rect(0,0,
+ composite.bounds.width - hasV,
+ composite.bounds.height - hasH
+ );
+ }
+
+ scaleHEnabled_ { |bool| scaleHEnabled = bool; this.updateSliderBounds; }
+ scaleVEnabled_ { |bool| scaleVEnabled = bool; this.updateSliderBounds; }
+
+ moveHEnabled_ { |bool| moveHEnabled = bool; this.updateSliderBounds; }
+ moveVEnabled_ { |bool| moveVEnabled = bool; this.updateSliderBounds; }
+
+ sliderWidth_ { |width = 12| sliderWidth = width; this.updateSliderBounds; }
+ sliderSpacing_ { |spacing = 2| sliderSpacing = spacing; this.updateSliderBounds; }
+ scaleSliderLength_ { |length = 52| scaleSliderLength = length; this.updateSliderBounds; }
+
+ sliderKnobColor_ { |color|
+ (scaleSliders ++ moveSliders).do(_.knobColor_(color));
+ }
+
+ sliderBackColor_ { |color|
+ (scaleSliders ++ moveSliders).do(_.background_(color));
+ }
+
+ setMoveSliderWidths { // |rect| // not used anymore
+ moveSliders[0].relThumbSize = (1 / userView.scaleH).min( userView.scaleH );
+ moveSliders[1].relThumbSize = (1 / userView.scaleV).min( userView.scaleV );
+ }
+
+
+ scaleH_ { |newScaleH, refreshFlag, updateFlag|
+ updateFlag = updateFlag ? true;
+ userView.scaleH_( newScaleH, refreshFlag );
+ this.updateSliders( updateFlag, false );
+ }
+
+ scaleV_ { |newScaleV, refreshFlag, updateFlag|
+ updateFlag = updateFlag ? true;
+ userView.scaleV_( newScaleV, refreshFlag );
+ this.updateSliders( updateFlag, false );
+ }
+
+ scale_ { |newScaleArray, refreshFlag, updateFlag| // can be single value, array or point
+ updateFlag = updateFlag ? true;
+ userView.scale_( newScaleArray, refreshFlag );
+ this.updateSliders( updateFlag, false );
+ }
+
+
+ moveH_ { |newMoveH, refreshFlag, updateFlag|
+ updateFlag = updateFlag ? true;
+ userView.moveH_( newMoveH, refreshFlag );
+ this.updateSliders( false, updateFlag );
+ }
+
+ moveV_ { |newMoveV, refreshFlag, updateFlag|
+ updateFlag = updateFlag ? true;
+ userView.moveV_( newMoveV, refreshFlag );
+ this.updateSliders( false, updateFlag );
+ }
+
+ move_ { |newMoveArray, refreshFlag, updateFlag| // can be single value, array or point
+ updateFlag = updateFlag ? true;
+ userView.move_( newMoveArray, refreshFlag );
+ this.updateSliders( false, updateFlag );
+ }
+
+ movePixels_ { |newPixelsArray, limit, refreshFlag, updateFlag|
+ updateFlag = updateFlag ? true;
+ userView.movePixels_( newPixelsArray, limit, refreshFlag );
+ this.updateSliders( false, updateFlag );
+ }
+
+ keepRatio_ { |bool = false|
+ userView.keepRatio = bool;
+ this.updateSliderBounds;
+ /*
+ scaleSliders[1].visible = bool.not;
+
+ moveSliders[1].bounds = moveSliders[1].bounds
+ .height_( composite.bounds.height -
+ [ scaleSliderLength + sliderWidth + (2 * sliderSpacing),
+ sliderWidth + sliderSpacing][ bool.binaryValue ] );
+ */
+ this.scaleH = this.scaleH;
+ }
+
+ refresh { //this.setMoveSliderWidths;
+ ^composite.refresh }
+
+ resize { ^resize }
+ resize_ { |val| resize = val; composite.resize_( val ) }
+
+ window { ^window ?? { window = composite.getParents.last.findWindow; } }
+
+ drawHook { ^this.window.drawHook }
+ drawHook_ { |func| this.window.drawHook = func; }
+
+ onClose { ^this.window.onClose }
+ onClose_ { |func| this.window.onClose = func; }
+
+ remove { composite.remove; }
+
+ }
+
+//// Soon to be replaced by above
+
ScaledUserViewWindow {
classvar <>defaultBounds, <>defaultFromBounds;
@@ -37,7 +370,7 @@
var sliderKnobColor, sliderBackColor;
sliderKnobColor = Color.gray(0.2);
sliderBackColor = Color.black.alpha_(0.33);
- window = SCWindow( inName, inBounds );
+ window = Window( inName, inBounds );
//window.view.background = Color.gray(0.8);
case { inViewOffset.class == Point }
{ viewOffset = [ inViewOffset.x, inViewOffset.y ]; }
Modified: wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundButton.sc
===================================================================
--- wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundButton.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundButton.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -28,7 +28,7 @@
mouseDown {
arg x, y, modifiers, buttonNumber, clickCount;
if( enabled ) {
- if( this.drawBounds.containsPoint(x@y) )
+ if( x.isNil or: { this.drawBounds.containsPoint(x@y) } )
{ mouseDownAction.value(this, x, y, modifiers, buttonNumber, clickCount); pressed = true; this.refresh; };
};
}
Modified: wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundNumberBox.sc
===================================================================
--- wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundNumberBox.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/osx/scide_scapp/Views/RoundNumberBox.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -13,10 +13,12 @@
var <formatFunc, <>interpretFunc, <>allowedChars = "+-.eE*/()%";
var <innerShadow;
+ var <autoScale = false; // BETA
+
var <keyString, <>step=1, <>scroll_step=1;
var <typingColor, <normalColor, <stringColor;
var <background;
- var <>clipLo = -inf, <>clipHi = inf, hit, inc=1.0,
+ var <>clipLo = -inf, <>clipHi = inf, hit, startHit, inc=1.0,
<>scroll=true; //, <>shift_step=0.1, <>ctrl_step=10;
var <>wrap = false;
@@ -177,6 +179,17 @@
string = keyString ?? { formatFunc.value(value).asString };
stringRect = this.stringRect;
+
+ if( autoScale )
+ { Pen.transformToRect( stringRect.insetBy(1,0), string.bounds( font ), true,
+ move: ( left: (0@xxx), right: (1@xxx), center: (0.5@xxx),
+ middle: (0.5@xxx) )[ align ] ? (0@xxx) );
+ stringRect = string.bounds( font );
+ };
+
+ //Pen.color = Color.green.alpha_( 0.5 ); // debug
+ //Pen.fillOval( stringRect );
+
if( (charSelectIndex >= 0) and: { charSelectIndex < string.size } )
{
@@ -189,12 +202,16 @@
Pen.font_( font );
Pen.color_( stringColor ? Color.black );
+ if( autoScale )
+ { Pen.stringCenteredIn( string, stringRect ); }
+ {
Pen.perform(
( left: \stringLeftJustIn, right: \stringRightJustIn,
center: \stringCenteredIn, middle: \stringCenteredIn )[ align ]
? \stringLeftJustIn, string, stringRect );
+ }
- });
+ });
if( enabled.not )
{ Pen.use{
@@ -212,19 +229,30 @@
charSelectRect { |stringRect, start = 0, range = 1|
var rect, stringStart, stringWidth;
- rect = this.drawBounds;
- stringRect = stringRect ?? { this.stringRect; };
- stringStart = string[..start-1].bounds( font ).width;
- stringWidth = string[start..(start+range)-1].bounds( font ).width;
- ^Rect( switch( align,
- \left, { (stringStart + stringRect.left) + 1 },
- \right, { ((stringStart + stringRect.right) - string.bounds(font).width) - 2 },
- \center, { stringStart + stringRect.left +
- ((stringRect.width - string.bounds(font).width)/2) },
- \middle, { stringStart + stringRect.left +
- ((stringRect.width - string.bounds(font).width)/2)
- }) ?? { stringStart + stringRect.left },
- rect.top, stringWidth + 0.5, rect.height );
+ if( autoScale )
+ {
+ stringRect = stringRect ?? { string.bounds( font ); };
+ stringStart = string[..start-1].bounds( font ).width;
+ stringWidth = string[start..(start+range)-1].bounds( font ).width;
+ ^Rect( stringStart + stringRect.left +
+ ((stringRect.width - string.bounds(font).width)/2),
+ stringRect.top, stringWidth + 0.5, stringRect.height );
+ }
+ {
+ rect = this.drawBounds;
+ stringRect = stringRect ?? { this.stringRect; };
+ stringStart = string[..start-1].bounds( font ).width;
+ stringWidth = string[start..(start+range)-1].bounds( font ).width;
+ ^Rect( switch( align,
+ \left, { (stringStart + stringRect.left) + 1 },
+ \right, {((stringStart + stringRect.right) - string.bounds(font).width)-2 },
+ \center, { stringStart + stringRect.left +
+ ((stringRect.width - string.bounds(font).width)/2) },
+ \middle, { stringStart + stringRect.left +
+ ((stringRect.width - string.bounds(font).width)/2)
+ }) ?? { stringStart + stringRect.left },
+ rect.top, stringWidth + 0.5, rect.height );
+ };
}
charIndexFromPoint { |point, exclude|
@@ -233,6 +261,12 @@
stringRect = this.charSelectRect(nil, 0, stringSize );
//stringWidth = stringRect.width;
exclude = exclude ? [];
+
+ if( autoScale )
+ { point = point.transformFromRect(
+ this.stringRect.insetBy(1,0), string.bounds( font ), true,
+ move: ( left: (0@xxx), right: (1@xxx), center: (0.5@xxx),
+ middle: (0.5@xxx) )[ align ] ? (0@xxx) ) };
if( exclude.includes(i) ) { i = i+1 };
while { (i < string.size) && {
(stringRect.left + string[..i].bounds( font ).width) < point.x; } }
@@ -255,6 +289,7 @@
if( enabled )
{
hit = Point(x,y);
+ startHit = hit;
if (scroll == true, { inc = this.getScale(modifiers) });
mouseDownAction.value(this, x, y, modifiers, buttonNumber, clickCount);
};
@@ -262,13 +297,23 @@
mouseMove { arg x, y, modifiers;
var direction;
+ var angle;
if( enabled ) {
if (scroll == true, {
direction = 1.0;
// horizontal or vertical scrolling:
- if ( (x - hit.x) < 0 or: { (y - hit.y) > 0 }) { direction = -1.0; };
+ //if ( (x - hit.x) < 0 or: { (y - hit.y) > 0 }) { direction = -1.0; };
+ angle = ((x@y) - hit).theta.wrap(-0.75pi, 1.25pi);
+ //angle = angle = ((x@y) - startHit).theta.wrap(-0.75pi, 1.25pi);
+ direction =
+ case { angle.inclusivelyBetween( -0.6pi, 0.1pi ) }
+ { 1.0 }
+ { angle.inclusivelyBetween( 0.4pi, 1.1pi ) }
+ { -1.0 }
+ { true }
+ { 0.0 };
if( value.respondsTo( '+' ) && { value.class != String } )
{ this.valueAction = (this.value + (inc * this.scroll_step * direction)); };
hit = Point(x, y);
Modified: wslib/wslib-classes/GUI/osx/scide_scapp/Views/SmoothSlider.sc
===================================================================
--- wslib/wslib-classes/GUI/osx/scide_scapp/Views/SmoothSlider.sc 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-classes/GUI/osx/scide_scapp/Views/SmoothSlider.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -13,6 +13,8 @@
var <>shift_scale = 100.0, <>ctrl_scale = 10.0, <>alt_scale = 0.1;
+ var <>grid = 0;
+
*viewClass { ^SCUserView }
init { arg parent, bounds;
@@ -332,7 +334,7 @@
mouseDown { arg x, y, modifiers, buttonNumber, clickCount;
if( enabled ) {
hit = Point(x,y);
-
+ mouseDownAction.value( this, x, y, modifiers, buttonNumber, clickCount );
hitValue = value;
this.mouseMove(x, y, modifiers);
};
Added: wslib/wslib-classes/Lang/osx/scide_scapp/extSCWindow-decorate.sc
===================================================================
--- wslib/wslib-classes/Lang/osx/scide_scapp/extSCWindow-decorate.sc (rev 0)
+++ wslib/wslib-classes/Lang/osx/scide_scapp/extSCWindow-decorate.sc 2009-12-19 12:40:27 UTC (rev 1298)
@@ -0,0 +1,7 @@
++ SCWindow { // shortcut for FlowLayout -- returns the Window !!
+ decorate { |margin, gap| view.decorator_( FlowLayout( view.bounds, margin, gap ) ); }
+ }
+
++ SCView { // shortcut for FlowLayout -- returns the Window !!
+ decorate { |margin, gap| this.decorator_( FlowLayout( this.bounds, margin, gap ) ); }
+ }
\ No newline at end of file
Modified: wslib/wslib-help/ScaledUserViewWindow.html
===================================================================
--- wslib/wslib-help/ScaledUserViewWindow.html 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-help/ScaledUserViewWindow.html 2009-12-19 12:40:27 UTC (rev 1298)
@@ -5,25 +5,22 @@
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
-<meta name="CocoaVersion" content="824.41">
+<meta name="CocoaVersion" content="949.54">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
-p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0001ee}
+p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0018e6}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
-p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
+p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0012b0}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
-p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #c50000}
-p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
-p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
-p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
-span.s1 {text-decoration: underline ; color: #0041d5}
+p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #a51515}
+p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9f1414}
+span.s1 {text-decoration: underline ; color: #0b35c9}
span.s2 {color: #000000}
span.s3 {text-decoration: underline}
-span.s4 {color: #0002ff}
-span.s5 {color: #0000bf}
-span.s6 {color: #0000ff}
+span.s4 {color: #001afb}
+span.s5 {color: #0012b0}
span.Apple-tab-span {white-space:pre}
</style>
</head>
@@ -56,18 +53,18 @@
<p class="p5"><br></p>
<p class="p7">(</p>
<p class="p9">// grab and move points</p>
-<p class="p10">w.clearDrawFuncs;</p>
-<p class="p10">p = { <span class="s5">Point</span>.rand( 1.0, 1.0 ) } ! 10;</p>
+<p class="p7">w.clearDrawFuncs;</p>
+<p class="p7">p = { <span class="s5">Point</span>.rand( 1.0, 1.0 ) } ! 10;</p>
<p class="p9"><span class="s2">a = </span><span class="s5">nil</span><span class="s2">; </span>// selected point</p>
-<p class="p11"><br></p>
-<p class="p10">w.drawFunc = {<span class="Apple-converted-space"> </span></p>
-<p class="p10"><span class="Apple-tab-span"> </span><span class="s5">Color</span>.green(0.5).alpha_(0.75).set;<span class="Apple-converted-space"> </span></p>
-<p class="p10"><span class="Apple-tab-span"> </span>p.do({ <span class="s5">|pt|</span> <span class="s5">Pen</span>.addArc( pt, 0.05, 0, 2pi ).fill; });</p>
-<p class="p10"><span class="Apple-tab-span"> </span>if( a.notNil ) { <span class="s5">Color</span>.red.set; <span class="s5">Pen</span>.addArc( p[a], 0.05, 0, 2pi ).stroke };</p>
-<p class="p10"><span class="Apple-tab-span"> </span>};</p>
-<p class="p11"><br></p>
-<p class="p10">w.mouseDownAction = { <span class="s5">|v, sx, sy|</span> a = p.detectIndex({ <span class="s5">|pt|</span> pt.dist( sx@sy ) <= 0.05 }); };</p>
-<p class="p10">w.mouseMoveAction = { <span class="s5">|v, sx, sy, m, x, y, inside|</span> if(inside and: a.notNil) { p[a] = (sx@sy) }; };</p>
+<p class="p5"><br></p>
+<p class="p7">w.drawFunc = {<span class="Apple-converted-space"> </span></p>
+<p class="p7"><span class="Apple-tab-span"> </span><span class="s5">Color</span>.green(0.5).alpha_(0.75).set;<span class="Apple-converted-space"> </span></p>
+<p class="p7"><span class="Apple-tab-span"> </span>p.do({ <span class="s5">|pt|</span> <span class="s5">Pen</span>.addArc( pt, 0.05, 0, 2pi ).fill; });</p>
+<p class="p7"><span class="Apple-tab-span"> </span>if( a.notNil ) { <span class="s5">Color</span>.red.set; <span class="s5">Pen</span>.addArc( p[a], 0.05, 0, 2pi ).stroke };</p>
+<p class="p7"><span class="Apple-tab-span"> </span>};</p>
+<p class="p5"><br></p>
+<p class="p7">w.mouseDownAction = { <span class="s5">|v, sx, sy|</span> a = p.detectIndex({ <span class="s5">|pt|</span> pt.dist( sx@sy ) <= 0.05 }); };</p>
+<p class="p7">w.mouseMoveAction = { <span class="s5">|v, sx, sy, m, x, y, inside|</span> if(inside and: a.notNil) { p[a] = (sx@sy) }; };</p>
<p class="p7">)</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
@@ -81,7 +78,7 @@
<p class="p2">holds to the ScaledUserView inside the window.<span class="Apple-converted-space"> </span></p>
<p class="p3"><br></p>
<p class="p2"><b>scaleSliders</b></p>
-<p class="p2">holds the two (small) scale sliders in an array. The sliders are all <a href="SmoothSlider.html"><span class="s6">SmoothSlider</span></a>.</p>
+<p class="p2">holds the two (small) scale sliders in an array. The sliders are all <a href="SmoothSlider.html"><span class="s4">SmoothSlider</span></a>.</p>
<p class="p3"><br></p>
<p class="p2"><b>moveSliders</b></p>
<p class="p2">holds the two scroll sliders in an array</p>
Modified: wslib/wslib-help/SmoothSlider.html
===================================================================
--- wslib/wslib-help/SmoothSlider.html 2009-12-18 16:31:44 UTC (rev 1297)
+++ wslib/wslib-help/SmoothSlider.html 2009-12-19 12:40:27 UTC (rev 1298)
@@ -5,35 +5,30 @@
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
-<meta name="CocoaVersion" content="949.46">
+<meta name="CocoaVersion" content="949.54">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
-p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
-p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9f1414}
+p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
+p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
-p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
-p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
-p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
+p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
+p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
+p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #950095}
p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #666666}
-p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
-span.s1 {text-decoration: underline ; color: #00138d}
-span.s2 {color: #00138d}
-span.s3 {color: #001afb}
-span.s4 {color: #0012b0}
-span.s5 {color: #535353}
-span.s6 {color: #741584}
+span.s1 {text-decoration: underline ; color: #00117a}
+span.s2 {color: #00117a}
+span.s3 {color: #001ff6}
+span.s4 {color: #0000bf}
+span.s5 {color: #666666}
+span.s6 {color: #950095}
span.s7 {color: #000000}
-span.s8 {color: #285e08}
+span.s8 {color: #007300}
span.s9 {font: 12.0px Helvetica}
-span.s10 {color: #0000bf}
-span.s11 {color: #666666}
-span.s12 {color: #950095}
-span.s13 {color: #007300}
-span.s14 {color: #bf0000}
+span.s10 {color: #bf0000}
span.Apple-tab-span {white-space:pre}
</style>
</head>
@@ -48,13 +43,28 @@
<p class="p2">Next to that it has a lot of extra options. SmoothSlider is inspired and partly based upon blackrains <a href="SC://Knob"><span class="s3">Knob</span></a>.</p>
<p class="p3"><br></p>
<p class="p4">(</p>
-<p class="p4">w = <span class="s4">SCWindow</span>( <span class="s5">"SmoothSlider"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
-<p class="p4">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">90</span>,<span class="s6">30</span>,<span class="s6">40</span>,<span class="s6">160</span>) ).value_(<span class="s6">0.75</span>)</p>
-<p class="p4"><span class="Apple-tab-span"> </span>.action_({ <span class="s4">|sl|</span> sl.value.postln; });</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"SmoothSlider"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
+<p class="p5">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">90</span>,<span class="s6">30</span>,<span class="s6">40</span>,<span class="s6">160</span>) ).value_(<span class="s6">0.75</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.action_({ <span class="s4">|sl|</span> [sl.value, <span class="s4">thisThread</span>.seconds].postln; });</p>
<p class="p4">)</p>
-<p class="p5"><br></p>
+<p class="p6"><br></p>
+<p class="p2">One of the advantages of SmoothSlider above SCSlider is that it doesn't need a deferred function to get or set its value when called from a SystemClock thread or OSC/MIDI responder. And when the action is called (via valueAction or doAction) it is done immediately instead of with the AppClock delay</p>
+<p class="p3"><br></p>
+<p class="p4">(</p>
+<p class="p5">t = <span class="s4">Task</span>({</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="s4">var</span> pt;</p>
+<p class="p5"><span class="Apple-tab-span"> </span>pt = <span class="s4">PintC</span>( <span class="s4">Pseq</span>( [b.value, <span class="s4">Pwhite</span>(<span class="s6">0.0</span>,<span class="s6">1.0</span>,<span class="s4">inf</span>)], <span class="s6">1 </span>), <span class="s6">1</span>/<span class="s4">Pseries</span>(<span class="s6">2</span>, <span class="s6">0.25</span>,<span class="s4">inf</span>) ).asStream;</p>
+<p class="p5"><span class="Apple-tab-span"> </span>b.doAction;</p>
+<p class="p5"><span class="Apple-converted-space"> <span class="Apple-tab-span"> </span></span><span class="s6">100</span>.do({ <span class="s4">|i|</span><span class="Apple-converted-space"> </span></p>
+<p class="p5"><span class="Apple-converted-space"> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>b.value = pt.next;<span class="Apple-converted-space"> </span></p>
+<p class="p5"><span class="Apple-converted-space"> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>b.background = <span class="s4">Color</span>.red.alpha_(0.5).blend( <span class="s4">Color</span>.black.alpha_(<span class="s6">0.25</span>), i/<span class="s6">99 </span>);</p>
+<p class="p5"><span class="Apple-converted-space"> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="s6">0.05</span>.wait });<span class="Apple-converted-space"> </span></p>
+<p class="p7"><span class="s7"><span class="Apple-tab-span"> </span>b.doAction; </span>// thisThread.seconds should differ exactly 5s from the first post</p>
+<p class="p5"><span class="Apple-tab-span"> </span>}).start;</p>
+<p class="p4">)</p>
+<p class="p6"><br></p>
<p class="p2">SmoothSlider listens to all messages as SCSlider does, but has a few extra of its own:</p>
-<p class="p5"><br></p>
+<p class="p6"><br></p>
<p class="p2"><b>mode</b></p>
<p class="p2">Mode indicates the way a SmoothSlider reacts to the mouse. The mode can be 'jump' or 'move'</p>
<p class="p3"><span class="Apple-tab-span"> </span></p>
@@ -62,145 +72,145 @@
<p class="p2"><span class="Apple-tab-span"> </span><b>'move' </b>:<span class="Apple-converted-space"> </span>the value only changes by the amount the mouse is moved after clicking, and doesn't</p>
<p class="p2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>jump to the mouse position.</p>
<p class="p3"><br></p>
-<p class="p6"><span class="s7">b.mode_( </span><span class="s8">\move</span><span class="s7"> ); </span>// try moving the slider before and after running this line</p>
-<p class="p5"><br></p>
-<p class="p6"><span class="s7">b.mode_( </span><span class="s8">\jump</span><span class="s7"> ); </span>// back to default<span class="s9"><b><span class="Apple-tab-span"> </span></b></span></p>
-<p class="p5"><br></p>
+<p class="p7"><span class="s7">b.mode_( </span><span class="s8">\move</span><span class="s7"> ); </span>// try moving the slider before and after running this line</p>
+<p class="p8"><br></p>
+<p class="p7"><span class="s7">b.mode_( </span><span class="s8">\jump</span><span class="s7"> ); </span>// back to default<span class="s9"><b><span class="Apple-tab-span"> </span></b></span></p>
+<p class="p6"><br></p>
<p class="p2"><b>knobColor</b></p>
<p class="p2"><b>background</b></p>
<p class="p2"><b>hilightColor</b></p>
<p class="p2">Colors, Gradients and SCImages can be used with these getter/setters.</p>
-<p class="p3"><br></p>
+<p class="p9"><br></p>
<p class="p7"><span class="s7">( </span>// random colors</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"colorful"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">250</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p9"><span class="s12">7</span><span class="s7">.do({ </span>|i|<span class="s7"> </span>SmoothSlider<span class="s7">( w, </span><span class="s12">30</span><span class="s7">@</span><span class="s12">100 </span><span class="s7">)</span></p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_( <span class="s10">Color</span>.rand(<span class="s12">0</span>,<span class="s12">0.8</span>).alpha_( [<span class="s12">1</span>,<span class="s12">0.5</span>,<span class="s12">1</span>,<span class="s12">1</span>,<span class="s12">0</span>,<span class="s12">1</span>,<span class="s12">0</span>][i] ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s10">Color</span>.rand(<span class="s12">0</span>,<span class="s12">0.8</span>).alpha_( [<span class="s12">1</span>,<span class="s12">0.5</span>,<span class="s12">0</span>,<span class="s12">1</span>,<span class="s12">1</span>,<span class="s12">0</span>,<span class="s12">0</span>][i] ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hilightColor_( <span class="s10">Color</span>.rand(<span class="s12">0</span>,<span class="s12">0.8</span>).alpha_( [<span class="s12">1</span>,<span class="s12">0.5</span>,<span class="s12">1</span>,<span class="s12">0</span>,<span class="s12">1</span>,<span class="s12">0</span>,<span class="s12">1</span>][i] ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( i.linlin( <span class="s12">0</span>,<span class="s12">6</span>,<span class="s12">0.2</span>,<span class="s12">0.8</span>) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"colorful"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">250</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p10"><span class="s6">7</span><span class="s7">.do({ </span>|i|<span class="s7"> </span>SmoothSlider<span class="s7">( w, </span><span class="s6">30</span><span class="s7">@</span><span class="s6">100 </span><span class="s7">)</span></p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_( <span class="s4">Color</span>.rand(<span class="s6">0</span>,<span class="s6">0.8</span>).alpha_( [<span class="s6">1</span>,<span class="s6">0.5</span>,<span class="s6">1</span>,<span class="s6">1</span>,<span class="s6">0</span>,<span class="s6">1</span>,<span class="s6">0</span>][i] ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s4">Color</span>.rand(<span class="s6">0</span>,<span class="s6">0.8</span>).alpha_( [<span class="s6">1</span>,<span class="s6">0.5</span>,<span class="s6">0</span>,<span class="s6">1</span>,<span class="s6">1</span>,<span class="s6">0</span>,<span class="s6">0</span>][i] ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hilightColor_( <span class="s4">Color</span>.rand(<span class="s6">0</span>,<span class="s6">0.8</span>).alpha_( [<span class="s6">1</span>,<span class="s6">0.5</span>,<span class="s6">1</span>,<span class="s6">0</span>,<span class="s6">1</span>,<span class="s6">0</span>,<span class="s6">1</span>][i] ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( i.linlin( <span class="s6">0</span>,<span class="s6">6</span>,<span class="s6">0.2</span>,<span class="s6">0.8</span>) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
<p class="p7"><span class="s7">( </span>// random gradients</p>
-<p class="p8">x = { <span class="s10">Color</span>.rand(<span class="s12">0</span>,<span class="s12">0.8</span>).alpha_( [<span class="s12">1.0</span>.rand ** <span class="s12">2</span>, <span class="s12">1</span>].choose ) };</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"gradients"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">250</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p9"><span class="s12">7</span><span class="s7">.do({ </span>|i|<span class="s7"> </span>SmoothSlider<span class="s7">( w, </span><span class="s12">30</span><span class="s7">@</span><span class="s12">100 </span><span class="s7">)</span></p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_( <span class="s10">Gradient</span>( x.(), x.(), [<span class="s13">\h</span>, <span class="s13">\v</span>].choose ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s10">Gradient</span>( x.(), x.(), [<span class="s13">\h</span>, <span class="s13">\v</span>].choose ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hilightColor_( <span class="s10">Gradient</span>( x.(), x.(), [<span class="s13">\h</span>, <span class="s13">\v</span>].choose ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( i.linlin( <span class="s12">0</span>,<span class="s12">6</span>,<span class="s12">0.2</span>,<span class="s12">0.8</span>) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>});</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p5">x = { <span class="s4">Color</span>.rand(<span class="s6">0</span>,<span class="s6">0.8</span>).alpha_( [<span class="s6">1.0</span>.rand ** <span class="s6">2</span>, <span class="s6">1</span>].choose ) };</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"gradients"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">250</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p10"><span class="s6">7</span><span class="s7">.do({ </span>|i|<span class="s7"> </span>SmoothSlider<span class="s7">( w, </span><span class="s6">30</span><span class="s7">@</span><span class="s6">100 </span><span class="s7">)</span></p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_( <span class="s4">Gradient</span>( x.(), x.(), [<span class="s8">\h</span>, <span class="s8">\v</span>].choose ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s4">Gradient</span>( x.(), x.(), [<span class="s8">\h</span>, <span class="s8">\v</span>].choose ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hilightColor_( <span class="s4">Gradient</span>( x.(), x.(), [<span class="s8">\h</span>, <span class="s8">\v</span>].choose ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( i.linlin( <span class="s6">0</span>,<span class="s6">6</span>,<span class="s6">0.2</span>,<span class="s6">0.8</span>) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>});</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
<p class="p7"><span class="s7">( </span>// random pictures</p>
<p class="p7">// downloads a selection of (free) patterns from the web</p>
<p class="p7">// ... might take a while ...</p>
<p class="p11"><span class="s7">p = [ </span>1<span class="s7">, </span>16<span class="s7">, </span>18<span class="s7">, </span>30<span class="s7">, </span>35<span class="s7">, </span>67<span class="s7">, </span>72<span class="s7">, </span>77<span class="s7">, </span>118<span class="s7">, </span>119<span class="s7">, </span>120<span class="s7">, </span>124<span class="s7">, </span>125<span class="s7">, </span>126<span class="s7">, </span>128<span class="s7">, </span>134<span class="s7">, </span>135<span class="s7">, </span>136<span class="s7">, </span>141<span class="s7">,<span class="Apple-converted-space"> </span></span></p>
<p class="p11"><span class="s7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>150<span class="s7">, </span>155<span class="s7">, </span>156<span class="s7">, </span>157<span class="s7">, </span>160<span class="s7">, </span>161<span class="s7">, </span>172<span class="s7">, </span>173<span class="s7">, </span>184<span class="s7">, </span>185<span class="s7">, </span>190<span class="s7">, </span>195<span class="s7">, </span>196 <span class="s7">].scramble[..</span>20<span class="s7">];</span></p>
-<p class="p12"><span class="s7">p = p.collect({ </span><span class="s10">|nr|</span><span class="s7"> </span>"http://static1.grsites.com/archive/textures/blue/blue%.jpg"</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.format( nr.asStringToBase(<span class="s12">10</span>,<span class="s12">3</span>) ); });</p>
-<p class="p8"><span class="Apple-tab-span"> </span>w = <span class="s10">SCWindow</span>( <span class="s11">"pictures"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">316</span>, <span class="s12">210 </span>) ).front.decorate;</p>
-<p class="p8"><span class="s12">7</span>.do({ <span class="s10">|i|</span></p>
-<p class="p8"><span class="Apple-tab-span"> </span>i = i*<span class="s12">3</span>;</p>
-<p class="p9"><span class="s7"><span class="Apple-tab-span"> </span></span>SmoothSlider<span class="s7">( w, </span><span class="s12">40</span><span class="s7">@</span><span class="s12">200 </span><span class="s7">)</span></p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_( <span class="s10">SCImage</span>( p[i] ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s10">SCImage</span>( p[i+<span class="s12">1</span>] ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hilightColor_( <span class="s10">SCImage</span>( p[i+<span class="s12">2</span>] ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( i.linlin( <span class="s12">0</span>,<span class="s12">18</span>,<span class="s12">0.2</span>,<span class="s12">0.8</span>) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.borderColor_(<span class="s10">Color</span>.clear)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>});</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"smoother smoothslider"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">250</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p8">z = <span class="s10">SmoothSlider</span>( w, <span class="s12">160</span>@<span class="s12">15 </span>).value_( <span class="s12">0.5 </span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.knobColor_(<span class="Apple-converted-space"> </span><span class="s10">Gradient</span>( <span class="s10">Color</span>.gray(<span class="s12">0.9</span>), <span class="s10">Color</span>.gray(<span class="s12">0.1</span>), <span class="s13">\h</span> ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.background_( <span class="s10">Gradient</span>( <span class="s10">Color</span>.black.alpha_(<span class="s12">0.8</span>), <span class="s10">Color</span>.white.alpha_(<span class="s12">0.8</span>), <span class="s13">\h</span> ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.hiliteColor_( <span class="s10">Gradient</span>( <span class="s10">Color</span>.blue.alpha_(<span class="s12">0.5</span>), <span class="s10">Color</span>.web.purple.alpha_(<span class="s12">0.25</span>), <span class="s13">\v</span> ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.knobSize_(<span class="s12">1</span>).canFocus_(<span class="s10">true</span>);</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p12"><span class="s7">p = p.collect({ </span><span class="s4">|nr|</span><span class="s7"> </span>"http://static1.grsites.com/archive/textures/blue/blue%.jpg"</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.format( nr.asStringToBase(<span class="s6">10</span>,<span class="s6">3</span>) ); });</p>
+<p class="p5"><span class="Apple-tab-span"> </span>w = <span class="s4">SCWindow</span>( <span class="s5">"pictures"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">316</span>, <span class="s6">210 </span>) ).front.decorate;</p>
+<p class="p5"><span class="s6">7</span>.do({ <span class="s4">|i|</span></p>
+<p class="p5"><span class="Apple-tab-span"> </span>i = i*<span class="s6">3</span>;</p>
+<p class="p10"><span class="s7"><span class="Apple-tab-span"> </span></span>SmoothSlider<span class="s7">( w, </span><span class="s6">40</span><span class="s7">@</span><span class="s6">200 </span><span class="s7">)</span></p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.knobColor_( <span class="s4">SCImage</span>( p[i] ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s4">SCImage</span>( p[i+<span class="s6">1</span>] ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hilightColor_( <span class="s4">SCImage</span>( p[i+<span class="s6">2</span>] ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( i.linlin( <span class="s6">0</span>,<span class="s6">18</span>,<span class="s6">0.2</span>,<span class="s6">0.8</span>) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.borderColor_(<span class="s4">Color</span>.clear)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>});</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"smoother smoothslider"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">250</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p5">z = <span class="s4">SmoothSlider</span>( w, <span class="s6">160</span>@<span class="s6">15 </span>).value_( <span class="s6">0.5 </span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.knobColor_(<span class="Apple-converted-space"> </span><span class="s4">Gradient</span>( <span class="s4">Color</span>.gray(<span class="s6">0.9</span>), <span class="s4">Color</span>.gray(<span class="s6">0.1</span>), <span class="s8">\h</span> ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.background_( <span class="s4">Gradient</span>( <span class="s4">Color</span>.black.alpha_(<span class="s6">0.8</span>), <span class="s4">Color</span>.white.alpha_(<span class="s6">0.8</span>), <span class="s8">\h</span> ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.hiliteColor_( <span class="s4">Gradient</span>( <span class="s4">Color</span>.blue.alpha_(<span class="s6">0.5</span>), <span class="s4">Color</span>.web.purple.alpha_(<span class="s6">0.25</span>), <span class="s8">\v</span> ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.knobSize_(<span class="s6">1</span>).canFocus_(<span class="s4">true</span>);</p>
+<p class="p5">)</p>
+<p class="p6"><br></p>
<p class="p2"><b>knobSize</b></p>
<p class="p2">knobSize is relative to the width of the slider. It defaults to 0.25.<span class="Apple-converted-space"> </span></p>
<p class="p2">The rounded edges of SmoothSlider are influenced by the knobSize.</p>
-<p class="p3"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"knobSize"</span>, <span class="s10">Rect</span>(<span class="s12">100</span>,<span class="s12">100</span>, <span class="s12">120</span>, <span class="s12">250 </span>) ).front.decorate;</p>
-<p class="p8">c = <span class="s10">SmoothSlider</span>( w, <span class="s12">50</span>@<span class="s12">200 </span>).value_(<span class="s12">1</span>).knobSize_( <span class="s12">1 </span>);</p>
-<p class="p8">d = <span class="s10">SmoothSlider</span>( w, <span class="s12">50</span>@<span class="s12">200 </span>).value_(<span class="s12">1</span>).knobSize_( <span class="s12">1 </span>);</p>
-<p class="p7"><span class="s7">c.action_({ </span><span class="s10">|sl|</span><span class="s7"> d.knobSize = sl.value; }); </span>// moving the slider changes the knobSize of the other</p>
-<p class="p8">d.action_({ <span class="s10">|sl|</span> c.knobSize = sl.value; });</p>
-<p class="p8">)</p>
-<p class="p5"><br></p>
+<p class="p9"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"knobSize"</span>, <span class="s4">Rect</span>(<span class="s6">100</span>,<span class="s6">100</span>, <span class="s6">120</span>, <span class="s6">250 </span>) ).front.decorate;</p>
+<p class="p5">c = <span class="s4">SmoothSlider</span>( w, <span class="s6">50</span>@<span class="s6">200 </span>).value_(<span class="s6">1</span>).knobSize_( <span class="s6">1 </span>);</p>
+<p class="p5">d = <span class="s4">SmoothSlider</span>( w, <span class="s6">50</span>@<span class="s6">200 </span>).value_(<span class="s6">1</span>).knobSize_( <span class="s6">1 </span>);</p>
+<p class="p7"><span class="s7">c.action_({ </span><span class="s4">|sl|</span><span class="s7"> d.knobSize = sl.value; }); </span>// moving the slider changes the knobSize of the other</p>
+<p class="p5">d.action_({ <span class="s4">|sl|</span> c.knobSize = sl.value; });</p>
+<p class="p5">)</p>
+<p class="p6"><br></p>
<p class="p2"><b>baseWidth</b></p>
<p class="p2">baseWidth is relative to the width of the sliders base. It defaults to 1.<span class="Apple-converted-space"> </span></p>
-<p class="p13"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"basewidths"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">250</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p8"><span class="s12">7</span>.do({ <span class="s10">|i|</span> <span class="s10">SmoothSlider</span>( w, <span class="s12">30</span>@<span class="s12">100 </span>).baseWidth_( <span class="s12">1</span>/(i+<span class="s12">1</span>) ).value_( i/<span class="s12">7 </span>); });</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"cocoa-like slider"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">200</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p8">z = <span class="s10">SmoothSlider</span>( w, <span class="s12">160</span>@<span class="s12">15 </span>).baseWidth_( <span class="s12">0.3 </span>).value_( <span class="s12">0.5 </span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.knobColor_(<span class="Apple-converted-space"> </span><span class="s10">Gradient</span>( <span class="s10">Color</span>.gray(<span class="s12">0.8</span>), <span class="s10">Color</span>.gray(<span class="s12">0.2</span>), <span class="s13">\h</span> ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.background_( <span class="s10">Gradient</span>( <span class="s10">Color</span>.black.alpha_(<span class="s12">0.8</span>), <span class="s10">Color</span>.white.alpha_(<span class="s12">0.8</span>), <span class="s13">\h</span> ) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.knobSize_(<span class="s12">1</span>).hilightColor_(<span class="s10">nil</span>).canFocus_(<span class="s10">false</span>);</p>
-<p class="p8">)</p>
-<p class="p5"><br></p>
+<p class="p3"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"basewidths"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">250</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p5"><span class="s6">7</span>.do({ <span class="s4">|i|</span> <span class="s4">SmoothSlider</span>( w, <span class="s6">30</span>@<span class="s6">100 </span>).baseWidth_( <span class="s6">1</span>/(i+<span class="s6">1</span>) ).value_( i/<span class="s6">7 </span>); });</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"cocoa-like slider"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">200</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p5">z = <span class="s4">SmoothSlider</span>( w, <span class="s6">160</span>@<span class="s6">15 </span>).baseWidth_( <span class="s6">0.3 </span>).value_( <span class="s6">0.5 </span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.knobColor_(<span class="Apple-converted-space"> </span><span class="s4">Gradient</span>( <span class="s4">Color</span>.gray(<span class="s6">0.8</span>), <span class="s4">Color</span>.gray(<span class="s6">0.2</span>), <span class="s8">\h</span> ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.background_( <span class="s4">Gradient</span>( <span class="s4">Color</span>.black.alpha_(<span class="s6">0.8</span>), <span class="s4">Color</span>.white.alpha_(<span class="s6">0.8</span>), <span class="s8">\h</span> ) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.knobSize_(<span class="s6">1</span>).hilightColor_(<span class="s4">nil</span>).canFocus_(<span class="s4">false</span>);</p>
+<p class="p5">)</p>
+<p class="p6"><br></p>
<p class="p2"><b>border</b></p>
<p class="p2"><b>borderColor</b></p>
<p class="p2">border is the size of the outline border around the slider. It defaults to 0 (no border).</p>
<p class="p2">borderColor defines the color of the border</p>
-<p class="p13"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"borders"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">250</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p8"><span class="s12">7</span>.do({ <span class="s10">|i|</span> <span class="s10">SmoothSlider</span>( w, <span class="s12">30</span>@<span class="s12">100 </span>).border_( i )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.borderColor_( <span class="s10">Color</span>.rand )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.value_( i/<span class="s12">7 </span>); });</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"levelmeters"</span>, <span class="s10">Rect</span>(<span class="s12">200</span>,<span class="s12">200</span>, <span class="s12">250</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p8"><span class="s12">7</span>.do({ <span class="s10">|i|</span></p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="s10">SmoothSlider</span>( w, <span class="s12">30</span>@<span class="s12">100 </span>).border_( <span class="s12">1 </span>).borderColor_( <span class="s10">Color</span>.gray(<span class="s12">0.2</span>) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( (i+<span class="s12">1</span>)/<span class="s12">7 </span>).knobSize_(<span class="s12">0</span>).canFocus_(<span class="s10">false</span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s10">Color</span>.white.alpha_(<span class="s12">0.25</span>) )</p>
-<p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hiliteColor_( <span class="s10">Gradient</span>( <span class="s10">Color</span>.red.alpha_(<span class="s12">0.9</span>), <span class="s10">Color</span>.green.alpha_(<span class="s12">0.8</span>), <span class="s13">\v</span> ) );</p>
-<p class="p8"><span class="Apple-tab-span"> </span>});</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p9"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"borders"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">250</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p5"><span class="s6">7</span>.do({ <span class="s4">|i|</span> <span class="s4">SmoothSlider</span>( w, <span class="s6">30</span>@<span class="s6">100 </span>).border_( i )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.borderColor_( <span class="s4">Color</span>.rand )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.value_( i/<span class="s6">7 </span>); });</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"levelmeters"</span>, <span class="s4">Rect</span>(<span class="s6">200</span>,<span class="s6">200</span>, <span class="s6">250</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p5"><span class="s6">7</span>.do({ <span class="s4">|i|</span></p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="s4">SmoothSlider</span>( w, <span class="s6">30</span>@<span class="s6">100 </span>).border_( <span class="s6">1 </span>).borderColor_( <span class="s4">Color</span>.gray(<span class="s6">0.2</span>) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.value_( (i+<span class="s6">1</span>)/<span class="s6">7 </span>).knobSize_(<span class="s6">0</span>).canFocus_(<span class="s4">false</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.background_( <span class="s4">Color</span>.white.alpha_(<span class="s6">0.25</span>) )</p>
+<p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.hiliteColor_( <span class="s4">Gradient</span>( <span class="s4">Color</span>.red.alpha_(<span class="s6">0.9</span>), <span class="s4">Color</span>.green.alpha_(<span class="s6">0.8</span>), <span class="s8">\v</span> ) );</p>
+<p class="p5"><span class="Apple-tab-span"> </span>});</p>
+<p class="p5">)</p>
+<p class="p6"><br></p>
<p class="p2"><b>extrude</b></p>
<p class="p2">extrude can make a SmoothSlider look more like regular SCSliders by adding a bevel around the base and the knob. It needs to be used in combination with <b>border</b>; if border == it will not show.<span class="Apple-converted-space"> </span></p>
-<p class="p5"><br></p>
-<p class="p4">(</p>
-<p class="p4">w = <span class="s4">SCWindow</span>( <span class="s5">"SmoothSlider"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
-<p class="p4">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">90</span>,<span class="s6">30</span>,<span class="s6">40</span>,<span class="s6">160</span>) ).value_(<span class="s6">0.75</span>)</p>
-<p class="p4"><span class="Apple-tab-span"> </span>.border_(1).extrude_(true);</p>
-<p class="p4">)</p>
-<p class="p5"><br></p>
-<p class="p4">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"which is which?"</span>, <span class="s10">Rect</span>( <span class="s12">300</span>,<span class="s12">150</span>,<span class="s12">220</span>,<span class="s12">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
-<p class="p8">b = <span class="s10">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s10">Rect</span>( <span class="s12">30</span>,<span class="s12">30</span>,<span class="s12">160</span>,<span class="s12">40</span>) ).value_(<span class="s12">0.8</span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.border_(<span class="s12">1</span>).extrude_(<span class="s10">true</span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.borderColor_( <span class="s10">Color</span>.clear ).knobColor_( <span class="s10">Color</span>.clear )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.background_( <span class="s10">Color</span>.clear ).hiliteColor_( <span class="s10">Color</span>.clear )</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.knobSize_(<span class="s12">0</span>).thumbSize_(<span class="s12">12</span>);</p>
-<p class="p8">c = <span class="s10">Slider</span>( w,<span class="Apple-converted-space"> </span><span class="s10">Rect</span>( <span class="s12">30</span>,<span class="s12">90</span>,<span class="s12">160</span>,<span class="s12">40</span>) ).value_(<span class="s12">0.8</span>)</p>
-<p class="p4">)</p>
-<p class="p5"><br></p>
-<p class="p5"><br></p>
+<p class="p8"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"SmoothSlider"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
+<p class="p5">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">90</span>,<span class="s6">30</span>,<span class="s6">40</span>,<span class="s6">160</span>) ).value_(<span class="s6">0.75</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.border_(<span class="s6">1</span>).extrude_(<span class="s4">true</span>);</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"which is which?"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
+<p class="p5">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">30</span>,<span class="s6">30</span>,<span class="s6">160</span>,<span class="s6">40</span>) ).value_(<span class="s6">0.8</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.border_(<span class="s6">1</span>).extrude_(<span class="s4">true</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.borderColor_( <span class="s4">Color</span>.clear ).knobColor_( <span class="s4">Color</span>.clear )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.background_( <span class="s4">Color</span>.clear ).hiliteColor_( <span class="s4">Color</span>.clear )</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.knobSize_(<span class="s6">0</span>).thumbSize_(<span class="s6">12</span>);</p>
+<p class="p5">c = <span class="s4">Slider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">30</span>,<span class="s6">90</span>,<span class="s6">160</span>,<span class="s6">40</span>) ).value_(<span class="s6">0.8</span>)</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
+<p class="p6"><br></p>
<p class="p2"><b>relThumbSize</b></p>
<p class="p2">the relThumbSize is a little different from the knobSize. It changes the <b>thumbSize</b> variable (inherited from SCSlider) but relative to the slider's length. The default thumbSize is 0. You will only see a change if the thumbSize becomes greater then the absolute knob size (<b>absKnobSize </b>- getter only).</p>
-<p class="p5"><br></p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"relThumbSize"</span>, <span class="s10">Rect</span>(<span class="s12">100</span>,<span class="s12">100</span>, <span class="s12">220</span>, <span class="s12">120 </span>) ).front.decorate;</p>
-<p class="p8">c = <span class="s10">SmoothSlider</span>( w, <span class="s12">200</span>@<span class="s12">50 </span>);</p>
-<p class="p8">d = <span class="s10">SmoothSlider</span>( w, <span class="s12">200</span>@<span class="s12">50 </span>);</p>
-<p class="p8">c.action_({ <span class="s10">|sl|</span> d.relThumbSize = sl.value; });</p>
-<p class="p8">d.action_({ <span class="s10">|sl|</span> c.relThumbSize = sl.value; });</p>
-<p class="p8">)</p>
-<p class="p5"><br></p>
+<p class="p6"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"relThumbSize"</span>, <span class="s4">Rect</span>(<span class="s6">100</span>,<span class="s6">100</span>, <span class="s6">220</span>, <span class="s6">120 </span>) ).front.decorate;</p>
+<p class="p5">c = <span class="s4">SmoothSlider</span>( w, <span class="s6">200</span>@<span class="s6">50 </span>);</p>
+<p class="p5">d = <span class="s4">SmoothSlider</span>( w, <span class="s6">200</span>@<span class="s6">50 </span>);</p>
+<p class="p5">c.action_({ <span class="s4">|sl|</span> d.relThumbSize = sl.value; });</p>
+<p class="p5">d.action_({ <span class="s4">|sl|</span> c.relThumbSize = sl.value; });</p>
+<p class="p5">)</p>
+<p class="p6"><br></p>
<p class="p2"><b>string</b></p>
<p class="p2"><b>font</b></p>
<p class="p2"><b>align</b></p>
@@ -210,62 +220,62 @@
<p class="p3"><br></p>
<p class="p7">////</p>
<p class="p7">//// example 1: orientation and styling</p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">Window</span>( <span class="s11">"string"</span>, <span class="s10">Rect</span>(<span class="s12">100</span>,<span class="s12">100</span>, <span class="s12">216</span>, <span class="s12">180 </span>) ).front;</p>
-<p class="p8">w.addFlowLayout;</p>
-<p class="p8">c = <span class="s10">SmoothSlider</span>( w, <span class="s12">50</span>@<span class="s12">150 </span>);</p>
-<p class="p8">d = <span class="s10">SmoothSlider</span>( w, <span class="s12">150</span>@<span class="s12">50 </span>);</p>
-<p class="p8">c.string = <span class="s11">"String 1"</span>;</p>
-<p class="p8">d.string = <span class="s11">"String 2"</span>;</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">Window</span>( <span class="s5">"string"</span>, <span class="s4">Rect</span>(<span class="s6">100</span>,<span class="s6">100</span>, <span class="s6">216</span>, <span class="s6">180 </span>) ).front;</p>
+<p class="p5">w.addFlowLayout;</p>
+<p class="p5">c = <span class="s4">SmoothSlider</span>( w, <span class="s6">50</span>@<span class="s6">150 </span>);</p>
+<p class="p5">d = <span class="s4">SmoothSlider</span>( w, <span class="s6">150</span>@<span class="s6">50 </span>);</p>
+<p class="p5">c.string = <span class="s5">"String 1"</span>;</p>
+<p class="p5">d.string = <span class="s5">"String 2"</span>;</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
<p class="p7"><span class="s7">( </span>// change color</p>
-<p class="p8">c.stringColor = <span class="s10">Color</span>.white;</p>
-<p class="p8">d.stringColor = <span class="s10">Color</span>.white;</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p5">c.stringColor = <span class="s4">Color</span>.white;</p>
+<p class="p5">d.stringColor = <span class="s4">Color</span>.white;</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
<p class="p7"><span class="s7">( </span>// change font</p>
-<p class="p8">c.font = <span class="s10">Font</span>( <span class="s11">"Times-Bold"</span>, <span class="s12">12 </span>);</p>
-<p class="p8">d.font = <span class="s10">Font</span>( <span class="s11">"Times-Bold"</span>, <span class="s12">12 </span>);</p>
-<p class="p8">)</p>
-<p class="p10"><br></p>
+<p class="p5">c.font = <span class="s4">Font</span>( <span class="s5">"Times-Bold"</span>, <span class="s6">12 </span>);</p>
+<p class="p5">d.font = <span class="s4">Font</span>( <span class="s5">"Times-Bold"</span>, <span class="s6">12 </span>);</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
<p class="p7">// change orientation (\v, \h, \up, \down or an angle)</p>
-<p class="p8">c.stringOrientation = <span class="s13">\v</span>;</p>
-<p class="p8">c.stringOrientation = <span class="s13">\h</span>;</p>
-<p class="p8">c.stringOrientation = <span class="s13">\up</span>;</p>
-<p class="p8">c.stringOrientation = <span class="s12">0.3</span>pi;</p>
-<p class="p8">c.stringOrientation = pi; <span class="s14">// upside down</span></p>
-<p class="p10"><br></p>
+<p class="p5">c.stringOrientation = <span class="s8">\v</span>;</p>
+<p class="p5">c.stringOrientation = <span class="s8">\h</span>;</p>
+<p class="p5">c.stringOrientation = <span class="s8">\up</span>;</p>
+<p class="p5">c.stringOrientation = <span class="s6">0.3</span>pi;</p>
+<p class="p5">c.stringOrientation = pi; <span class="s10">// upside down</span></p>
+<p class="p8"><br></p>
<p class="p7">// change alignment</p>
-<p class="p8">d.align = <span class="s13">\left</span>;</p>
-<p class="p4">d.align = <span class="s13">\right</span>;</p>
-<p class="p4">d.align = <span class="s13">\center</span>;</p>
-<p class="p10"><br></p>
+<p class="p5">d.align = <span class="s8">\left</span>;</p>
+<p class="p5">d.align = <span class="s8">\right</span>;</p>
+<p class="p5">d.align = <span class="s8">\center</span>;</p>
+<p class="p8"><br></p>
<p class="p7">////</p>
<p class="p7">//// example 2: dynamic string</p>
-<p class="p8">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"SmoothSlider"</span>, <span class="s10">Rect</span>( <span class="s12">300</span>,<span class="s12">150</span>,<span class="s12">220</span>,<span class="s12">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
-<p class="p8">b = <span class="s10">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s10">Rect</span>( <span class="s12">30</span>,<span class="s12">30</span>,<span class="s12">160</span>,<span class="s12">40</span>) ).value_(<span class="s12">0.75</span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.action_({ <span class="s10">|sl|</span> sl.string = <span class="s11">"value: %"</span>.format(sl.value.round(<span class="s12">0.001</span>) ); });</p>
-<p class="p8">b.stringColor = <span class="s10">Color</span>.white;</p>
-<p class="p8">b.doAction;</p>
-<p class="p8">)</p>
-<p class="p5"><br></p>
-<p class="p3"><b></b><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"SmoothSlider"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
+<p class="p5">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">30</span>,<span class="s6">30</span>,<span class="s6">160</span>,<span class="s6">40</span>) ).value_(<span class="s6">0.75</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.action_({ <span class="s4">|sl|</span> sl.string = <span class="s5">"value: %"</span>.format(sl.value.round(<span class="s6">0.001</span>) ); });</p>
+<p class="p5">b.stringColor = <span class="s4">Color</span>.white;</p>
+<p class="p5">b.doAction;</p>
+<p class="p5">)</p>
+<p class="p8"><br></p>
+<p class="p3"><br></p>
<p class="p2"><b>stringAlignToKnob</b></p>
<p class="p2">Makes the text align to the position of the knob</p>
<p class="p3"><br></p>
-<p class="p5"><br></p>
-<p class="p4">(</p>
-<p class="p8">w = <span class="s10">SCWindow</span>( <span class="s11">"SmoothSlider"</span>, <span class="s10">Rect</span>( <span class="s12">300</span>,<span class="s12">150</span>,<span class="s12">220</span>,<span class="s12">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
-<p class="p8">b = <span class="s10">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s10">Rect</span>( <span class="s12">90</span>,<span class="s12">30</span>,<span class="s12">40</span>,<span class="s12">160</span>) ).value_(<span class="s12">0.75</span>)</p>
-<p class="p8"><span class="Apple-tab-span"> </span>.action_({ <span class="s10">|sl|</span> sl.string = sl.value.round(<span class="s12">0.01 </span>).asString; });</p>
-<p class="p8">b.stringColor = <span class="s10">Color</span>.white;</p>
-<p class="p8">b.thumbSize = <span class="s12">16</span>;</p>
-<p class="p8">b.stringAlignToKnob = <span class="s10">true</span>;</p>
-<p class="p8">b.doAction;</p>
-<p class="p4">)</p>
-<p class="p3"><br></p>
-<p class="p5"><br></p>
+<p class="p8"><br></p>
+<p class="p5">(</p>
+<p class="p5">w = <span class="s4">SCWindow</span>( <span class="s5">"SmoothSlider"</span>, <span class="s4">Rect</span>( <span class="s6">300</span>,<span class="s6">150</span>,<span class="s6">220</span>,<span class="s6">220</span>) ).front; <span class="Apple-converted-space"> </span></p>
+<p class="p5">b = <span class="s4">SmoothSlider</span>( w,<span class="Apple-converted-space"> </span><span class="s4">Rect</span>( <span class="s6">90</span>,<span class="s6">30</span>,<span class="s6">40</span>,<span class="s6">160</span>) ).value_(<span class="s6">0.75</span>)</p>
+<p class="p5"><span class="Apple-tab-span"> </span>.action_({ <span class="s4">|sl|</span> sl.string = sl.value.round(<span class="s6">0.01 </span>).asString; });</p>
+<p class="p5">b.stringColor = <span class="s4">Color</span>.white;</p>
+<p class="p5">b.thumbSize = <span class="s6">16</span>;</p>
+<p class="p5">b.stringAlignToKnob = <span class="s4">true</span>;</p>
+<p class="p5">b.doAction;</p>
+<p class="p5">)</p>
+<p class="p9"><br></p>
+<p class="p8"><br></p>
</body>
</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/