[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: supercollider:[8092] trunk/build/SCClassLibrary/Common/GUI/osx/ Base/SCView.sc



Revision: 8092
          http://supercollider.svn.sourceforge.net/supercollider/?rev=8092&view=rev
Author:   decampo
Date:     2008-12-10 10:34:40 +0000 (Wed, 10 Dec 2008)

Log Message:
-----------
increment/decrement for SCSlider and SCRangeSlider now work with vertical and horizontal sliders; and provide a zoom arg for finetuning.

Modified Paths:
--------------
    trunk/build/SCClassLibrary/Common/GUI/osx/Base/SCView.sc

Modified: trunk/build/SCClassLibrary/Common/GUI/osx/Base/SCView.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/osx/Base/SCView.sc	2008-12-10 02:36:39 UTC (rev 8091)
+++ trunk/build/SCClassLibrary/Common/GUI/osx/Base/SCView.sc	2008-12-10 10:34:40 UTC (rev 8092)
@@ -621,8 +621,8 @@
 		this.setPropertyWithAction(\value, val);
 	}	
 	
-	increment { ^this.valueAction = this.value + (this.step ?? { this.pixelStep }) }
-	decrement { ^this.valueAction = this.value - (this.step ?? { this.pixelStep }) }
+	increment { |zoom=1| ^this.valueAction = this.value + (max(this.step, this.pixelStep) * zoom) }
+	decrement { |zoom=1| ^this.valueAction = this.value - (max(this.step, this.pixelStep) * zoom) }
 	
 	pixelStep { 
 		var bounds = this.bounds; 
@@ -722,28 +722,30 @@
 		^super.properties ++ #[\lo, \hi]
 	}
 	
-	increment { 
-		var inc, val; 
-		inc = this.bounds.width.reciprocal;
-		val = this.hi + inc;
-		if (val > 1, {
-			inc = 1 - this.hi;
-			val = 1;
-		});
-		this.activeLo_(this.lo + inc);
-		this.activeHi_(val);
+	pixelStep { 
+		var bounds = this.bounds; 
+		^(bounds.width.max(bounds.height)).reciprocal
 	}
-	decrement { 
-		var inc, val;
-		inc = this.bounds.width.reciprocal;
-		val = this.lo - inc;
-		if (val < 0, {
-			inc = this.lo;
-			val = 0;
-		});
-		this.activeLo_(val);
-		this.activeHi_(this.hi - inc);
+
+	increment { |zoom=1|
+		var inc = (max(this.step, this.pixelStep) * zoom); 
+		var newHi = (this.hi + inc);
+		if (newHi > 1) { 
+			inc = 1 - this.hi; 
+			newHi = 1; 
+		};
+		this.lo_(this.lo + inc).activeHi_(newHi);
 	}
+	
+	decrement { |zoom=1|
+		var inc = (max(this.step, this.pixelStep) * zoom); 
+		var newLo = (this.lo - inc);
+		if (newLo < 0) { 
+			inc =  this.lo; 
+			newLo = 0; 
+		};
+		this.lo_(newLo).activeHi_(this.hi - inc);
+	}
 
 	defaultKeyDownAction { arg char, modifiers, unicode;
 		var a, b;


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/