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

[sc-dev] SF.net SVN: supercollider:[8325] trunk/build



Revision: 8325
          http://supercollider.svn.sourceforge.net/supercollider/?rev=8325&view=rev
Author:   jmfuo
Date:     2008-12-29 20:38:29 +0000 (Mon, 29 Dec 2008)

Log Message:
-----------
Tightened  up and commented code

Modified Paths:
--------------
    trunk/build/Help/GUI/EZ-GUI/EZSliderSC.html
    trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc
    trunk/build/SCClassLibrary/Common/GUI/Base/EZNumber.sc
    trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc
    trunk/build/SCClassLibrary/Common/GUI/Base/EZSlider.sc
    trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc

Modified: trunk/build/Help/GUI/EZ-GUI/EZSliderSC.html
===================================================================
--- trunk/build/Help/GUI/EZ-GUI/EZSliderSC.html	2008-12-29 20:30:28 UTC (rev 8324)
+++ trunk/build/Help/GUI/EZ-GUI/EZSliderSC.html	2008-12-29 20:38:29 UTC (rev 8325)
@@ -24,21 +24,21 @@
 p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
 p.p16 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
 p.p17 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
-p.p18 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; color: #000000; min-height: 17.0px}
+p.p18 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
 span.s1 {font: 18.0px Helvetica}
-span.s2 {color: #5d67a2}
-span.s3 {color: #656b96}
+span.s2 {color: #61699c}
+span.s3 {color: #676d92}
 span.s4 {color: #000000}
 span.s5 {text-decoration: underline}
-span.s6 {color: #686e90}
-span.s7 {color: #6f7182}
+span.s6 {color: #6a708c}
+span.s7 {color: #6f7180}
 span.s8 {font: 11.0px Monaco}
-span.s9 {color: #314bd1}
+span.s9 {color: #3e54c5}
 span.s10 {color: #0000bf}
 span.s11 {color: #606060}
 span.s12 {color: #6f7178}
-span.s13 {color: #6f7185}
-span.s14 {color: #0000ff}
+span.s13 {color: #6f7183}
+span.s14 {color: #0c2eee}
 span.s15 {color: #007300}
 span.Apple-tab-span {white-space:pre}
 </style>
@@ -142,13 +142,7 @@
 <p class="p11"><b><span class="Apple-tab-span">	</span></b></p>
 <p class="p10"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b>Sets/gets it the component views are visible.</p>
 <p class="p12"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><b>bool </b>- An Instance of <a href="../../Core/Boolean.html"><span class="s13">Boolean</span></a>. Default is true;</p>
-<p class="p13"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
-<p class="p10"><b><span class="Apple-tab-span">	</span>enabled</b></p>
-<p class="p10"><b><span class="Apple-tab-span">	</span>enabled_(bool)</b></p>
-<p class="p11"><b><span class="Apple-tab-span">	</span></b></p>
-<p class="p10"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b>Sets/gets if the list is enabled.</p>
-<p class="p12"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><b>bool </b>- An Instance of <a href="../../Core/Boolean.html"><span class="s13">Boolean</span></a>. Default is true;</p>
-<p class="p13"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
+<p class="p13"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
 <p class="p17"><b>Changing Appearance</b></p>
 <p class="p2"><span class="Apple-tab-span">	</span></p>
 <p class="p10"><b><span class="Apple-tab-span">	</span>setColors(stringBackground,strColor,sliderColor,boxColor,</b></p>
@@ -178,7 +172,7 @@
 <p class="p14"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>g=<span class="s10">EZSlider</span>(w, 400@16,<span class="s11">" test<span class="Apple-converted-space">  </span>"</span>, <span class="s15">\freq</span>,unitWidth:30, numberWidth:60,layout:<span class="s15">\horz</span>);</p>
 <p class="p14"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>g.setColors(<span class="s10">Color</span>.grey,<span class="s10">Color</span>.white, <span class="s10">Color</span>.grey(0.7),<span class="s10">Color</span>.grey, <span class="s10">Color</span>.white, <span class="s10">Color</span>.yellow);</p>
 <p class="p14">);</p>
-<p class="p15"><br></p>
+<p class="p14">g.view.enabled=<span class="s10">false</span></p>
 <p class="p16">// lots of sliders on on view</p>
 <p class="p14">(</p>
 <p class="p14">w=<span class="s10">Window</span>.new.front;</p>
@@ -377,6 +371,6 @@
 <p class="p14">};</p>
 <p class="p14">});</p>
 <p class="p14">)</p>
-<p class="p15"><span class="Apple-tab-span">	</span></p>
+<p class="p3"><span class="Apple-tab-span">	</span></p>
 </body>
 </html>

Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc	2008-12-29 20:30:28 UTC (rev 8324)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc	2008-12-29 20:38:29 UTC (rev 8325)
@@ -7,9 +7,11 @@
 		labelWidth = labelWidth ? 80;
 		layout=arglayout ? \vert;
 		labelSize=labelWidth@labelHeight;
-
+		
+		// if no parent, then pop up window 
 		parentView.isNil.if{
 				if (bounds.class==Point){
+					// if bounds is a point the place the window on screen
 					winBounds=Rect(200, Window.screenBounds.height-bounds.y-100,
 					bounds.x,bounds.y)
 					}{winBounds=bounds};
@@ -17,16 +19,20 @@
 				parentView=w.asView;
 				w.front;
 				bounds=bounds.asRect;
+				// inset the bounds to make a nice margin
 				bounds=Rect(4,4,bounds.width-8,bounds.height-24);
 				view=GUI.compositeView.new(parentView,bounds).resize_(5).relativeOrigin_(true);
-			}{
-			
+		
+		// normal parent view			
+		}{
 			bounds=bounds.asRect;
 			view=GUI.compositeView.new(parentView,bounds).relativeOrigin_(true);
 		};
 
+		// calcualate bounds
 		# labelBounds,listBounds = this.prSubViewBounds(bounds, label.notNil);
 		
+		// insert the views	
 		label.notNil.if{ //only add a label if desired
 			if (layout==\vert){
 				labelView = GUI.staticText.new(view, labelBounds).resize_(2);

Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZNumber.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZNumber.sc	2008-12-29 20:30:28 UTC (rev 8324)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZNumber.sc	2008-12-29 20:38:29 UTC (rev 8325)
@@ -20,7 +20,7 @@
 		var labelBounds, numBounds,w, winBounds, 
 				viewBounds, unitBounds;
 						
-		// try to use the paretn decorator gap
+		// try to use the parent decorator gap
 		var	decorator = parentView.asView.tryPerform(\decorator);
 		argGap.isNil.if{ 
 			gap = decorator.tryPerform(\gap);
@@ -31,11 +31,11 @@
 		numberWidth = argNumberWidth;
 		layout=argLayout;
 		
-		// pop up window
+		// if no parent, then pop up window 
 		parentView.isNil.if{
 			popUp=true;
+				bounds.isNil.if {bounds= 160@20};
 				// if bounds is a point the place the window on screen
-				bounds.isNil.if {bounds= 160@20};
 				if (bounds.class==Point)
 					{ bounds = bounds.x@max(bounds.y,bounds.y+24);// window minimum height;
 					 winBounds=Rect(200, Window.screenBounds.height-bounds.y-100,
@@ -47,17 +47,14 @@
 				parentView=w.asView;
 				w.front;
 				bounds=bounds.asRect;
-				// If numberWidth is set, then adjust the parent view size  both subviews
-				//numberWidth.notNil.if{ bounds=bounds.width_(labelWidth+gap.x+numberWidth)};
 				// inset the bounds to make a nice margin
 				bounds=Rect(4,4,bounds.width-8,bounds.height-24);
 				view=GUI.compositeView.new(parentView,bounds)
 					.relativeOrigin_(true).resize_(2);
-			}{
+		// normal parent view			
+		}{
 			bounds.isNil.if{bounds= 160@20};
 			bounds=bounds.asRect;
-				// If numberWidth is set, then adjust the parent view size  both subviews
-				//numberWidth.notNil.if{ bounds=bounds.width_(labelWidth+gap.x+numberWidth)};
 			view=GUI.compositeView.new(parentView,bounds).relativeOrigin_(true);
 		};
 		
@@ -67,7 +64,9 @@
 		// calcualate bounds
 		# labelBounds,numBounds, unitBounds 
 				= this.prSubViewBounds(bounds, label.notNil, unitWidth>0);
-
+			
+		// insert the views	
+		
 		label.notNil.if{ //only add a label if desired
 				labelView = GUI.staticText.new(view, labelBounds);
 			if (layout==\line2)
@@ -80,6 +79,9 @@
 			unitView = GUI.staticText.new(view, unitBounds);
 		};
 
+
+		// set view parameters and actions
+
 		controlSpec = argControlSpec.asSpec;
 		(unitWidth>0).if{ unitView.string = " "++controlSpec.units.asString};
 		initVal = initVal ? controlSpec.default;
@@ -121,17 +123,14 @@
 			numberView.value = value.round(round);
 		};
 	}
-			
-	enabled {  ^numberView.enabled } 
-	enabled_ { |bool| numberView.enabled_(bool) }
+				
 	
+	prSetViewParams{ // sets resize and alignment for different layouts
 	
-	prSetViewParams{
-	
 		switch (layout,
 		\line2, {
-			labelView.notNil.if{labelView.resize_(2).align_(\left)};
-			unitView.notNil.if{unitView.resize_(6).align_(\left)};
+			labelView.notNil.if{labelView.resize_(2)};
+			unitView.notNil.if{unitView.resize_(6)};
 			numberView.resize_(5);
 		},
 		\horz, {
@@ -148,7 +147,8 @@
 	}
 	
 	prSubViewBounds{arg rect, hasLabel, hasUnit;
-		var numBounds,labelBounds,sliderBounds, unitBounds, gap1, gap2, numY;
+		var numBounds,labelBounds,sliderBounds;
+		var unitBounds, gap1, gap2, numY;
 		gap1 = gap;	
 		gap2 = gap1;
 		hasLabel.not.if{ gap1 = 0@0; labelSize=0@0};
@@ -157,7 +157,7 @@
 		switch (layout,
 			\line2, {
 			
-				labelBounds = Rect(
+				labelBounds = Rect( // fill the line
 						0,
 						0,
 						rect.width, 
@@ -166,18 +166,18 @@
 						
 				numSize.y=numSize.y-gap1.y;
 				numY=labelBounds.height+gap1.y;
-				unitBounds = Rect( view.bounds.width - unitWidth,
+				unitBounds = Rect( view.bounds.width - unitWidth, // //adjust to fit
 					numY, unitWidth, numSize.y);
 				numBounds = Rect(0, numY, 
-					rect.width-unitWidth-gap2.x, numSize.y); // view to right
+					rect.width-unitWidth-gap2.x, numSize.y); // to right
 					
 				},
 							
 			 \horz, {
 				labelSize.y=view.bounds.height;
-				labelBounds = (labelSize.x@xxxxxxxxxxx).asRect;
-				unitBounds = (unitWidth@xxxxxxxxxxx).asRect.left_(rect.width-unitWidth);
-				numBounds  =  Rect(
+				labelBounds = (labelSize.x@xxxxxxxxxxx).asRect; // to left
+				unitBounds = (unitWidth@xxxxxxxxxxx).asRect.left_(rect.width-unitWidth); // to right
+				numBounds  =  Rect( //adjust to fit
 					labelBounds.width+gap1.x,
 					0,
 					rect.width - labelBounds.width - unitBounds.width - gap1.x - gap2.x , 

Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc	2008-12-29 20:30:28 UTC (rev 8324)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc	2008-12-29 20:38:29 UTC (rev 8325)
@@ -7,8 +7,10 @@
 		layout=arglayout ? \horz;
 		labelSize=labelWidth@labelHeight;
 		
+		// if no parent, then pop up window 
 		parentView.isNil.if{
 				bounds.isNil.if{bounds= 160@44};
+				// if bounds is a point the place the window on screen
 				if (bounds.class==Point){
 					bounds = bounds.x@max(bounds.y,bounds.y+24);// window minimum height;
 					winBounds=Rect(200, Window.screenBounds.height-bounds.y-100,
@@ -20,16 +22,22 @@
 				parentView=w.asView;
 				w.front;
 				bounds=bounds.asRect;
+				// inset the bounds to make a nice margin
 				bounds=Rect(4,4,bounds.width-8,bounds.height-24);
 				view=GUI.compositeView.new(parentView,bounds).relativeOrigin_(true).resize_(2);
-			}{
+				
+		// normal parent view			
+		}{
 			bounds.isNil.if{bounds= 160@20};
 			bounds=bounds.asRect;
 			view=GUI.compositeView.new(parentView,bounds).relativeOrigin_(true);
 		};
+		
+		// calcualate bounds
+		# labelBounds,listBounds = this.prSubViewBounds(bounds, label.notNil);
 
-		# labelBounds,listBounds = this.prSubViewBounds(bounds, label.notNil);
-		
+		// insert the views	
+
 		label.notNil.if{ //only add a label if desired
 			if (layout==\vert){
 				labelView = GUI.staticText.new(view, labelBounds).resize_(2);

Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZSlider.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZSlider.sc	2008-12-29 20:30:28 UTC (rev 8324)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZSlider.sc	2008-12-29 20:38:29 UTC (rev 8325)
@@ -21,7 +21,7 @@
 		var labelBounds, numBounds,w, winBounds, 
 				viewBounds, unitBounds,sliderBounds;
 				
-		// try to use the paretn decorator gap
+		// try to use the parent decorator gap
 		var	decorator = parentView.asView.tryPerform(\decorator);
 		argGap.isNil.if{ 
 			gap = decorator.tryPerform(\gap);
@@ -32,27 +32,29 @@
 		numberWidth = argNumberWidth;
 		layout=argLayout;
 		
-		// pop up window
+		// if no parent, then pop up window 
 		parentView.isNil.if{
-				popUp=true;
-				bounds.isNil.if{bounds = 350@20};
-					//if its a point, then place the Window on the screen
-				if (bounds.class == Point){
-					bounds = bounds.x@max(bounds.y,bounds.y+24);// window minimum height;
-					winBounds = Rect(200, Window.screenBounds.height-bounds.y-100,
-					bounds.x,bounds.y)
-					}{// window minimum height;
-					winBounds = bounds.height_(max(bounds.height,bounds.height+24))
-					};
-				w = GUI.window.new("",winBounds).alwaysOnTop_(alwaysOnTop);
-				parentView = w.asView;
-				w.front;
-				bounds = bounds.asRect;
-				// inset the bounds to make a nice margin
-				bounds = Rect(4,4,bounds.width-8,bounds.height-24);
-				view = GUI.compositeView.new(parentView,bounds)
-						.relativeOrigin_(true).resize_(5);
-			}{
+			popUp=true;
+			bounds.isNil.if{bounds = 350@20};
+				//if its a point, then place the Window on the screen
+			if (bounds.class == Point){
+				bounds = bounds.x@max(bounds.y,bounds.y+24);// window minimum height;
+				winBounds = Rect(200, Window.screenBounds.height-bounds.y-100,
+				bounds.x,bounds.y)
+				}{// window minimum height;
+				winBounds = bounds.height_(max(bounds.height,bounds.height+24))
+				};
+			w = GUI.window.new("",winBounds).alwaysOnTop_(alwaysOnTop);
+			parentView = w.asView;
+			w.front;
+			bounds = bounds.asRect;
+			// inset the bounds to make a nice margin
+			bounds = Rect(4,4,bounds.width-8,bounds.height-24);
+			view = GUI.compositeView.new(parentView,bounds)
+					.relativeOrigin_(true).resize_(5);
+					
+		// normal parent view			
+		}{ 
 			bounds.isNil.if{bounds = 160@20};
 			bounds = bounds.asRect;
 			view = GUI.compositeView.new(parentView,bounds).relativeOrigin_(true);
@@ -61,10 +63,11 @@
 		labelSize=labelWidth@labelHeight;
 		numSize = numberWidth@labelHeight;
 		
-		// calcualate bounds
+		// calculate bounds of all subviews
 		# labelBounds,numBounds,sliderBounds, unitBounds 
 				= this.prSubViewBounds(bounds, label.notNil, unitWidth>0);
-
+		
+		// instert the views
 		label.notNil.if{ //only add a label if desired
 			labelView = GUI.staticText.new(view, labelBounds);
 			labelView.string = label;
@@ -74,11 +77,12 @@
 			unitView = GUI.staticText.new(view, unitBounds);
 		};
 
-
 		numberView = GUI.numberBox.new(view, numBounds);
 		sliderView = GUI.slider.new(view, sliderBounds);
 		
 		
+		// set view parameters and actions
+		
 		controlSpec = argControlSpec.asSpec;
 		(unitWidth>0).if{unitView.string = " "++controlSpec.units.asString};
 		initVal = initVal ? controlSpec.default;
@@ -87,6 +91,7 @@
 		sliderView.action = {
 			this.valueAction_(controlSpec.map(sliderView.value));
 		};
+		
 		if (controlSpec.step == 0) {
 			sliderView.step = (controlSpec.step / (controlSpec.maxval - controlSpec.minval));
 		};
@@ -115,10 +120,12 @@
 		numberView.value = value.round(round);
 		sliderView.value = controlSpec.unmap(value);
 	}
+	
 	valueAction_ { arg val; 
 		this.value_(val);
 		this.doAction;
 	}
+	
 	doAction { action.value(this) }
 
 	set { arg label, spec, argAction, initVal, initAction = false;
@@ -134,23 +141,18 @@
 			numberView.value = value.round(round);
 		};
 	}
-	
-	
-	enabled { ^sliderView.enabled } 
-	enabled_ { |bool| [sliderView, numberView].do(_.enabled_(bool)) }
-	
 		
-	prSetViewParams{
-	
+	prSetViewParams{ // sets resize and alignment for different layouts
+		
 		switch (layout,
 		\line2, {
 			labelView.notNil.if{
-				labelView.resize_(2).align_(\left);
-				unitView.notNil.if{unitView.resize_(3).align_(\left)};
+				labelView.resize_(2);
+				unitView.notNil.if{unitView.resize_(3)};
 				numberView.resize_(3);
 				}{
 				unitView.notNil.if{
-					unitView.resize_(2).align_(\left);
+					unitView.resize_(2);
 					numberView.resize_(1);
 					}{
 					numberView.resize_(2);
@@ -160,23 +162,25 @@
 			popUp.if{view.resize_(2)};
 		},
 		\vert, {
-			labelView.notNil.if{labelView.resize_(2).align_(\left)};
-			unitView.notNil.if{unitView.resize_(8).align_(\left)};
+			labelView.notNil.if{labelView.resize_(2)};
+			unitView.notNil.if{unitView.resize_(8)};
 			numberView.resize_(8);
 			sliderView.resize_(5);
 			popUp.if{view.resize_(4)};
 		},
 		\horz, {
 			labelView.notNil.if{labelView.resize_(4).align_(\right)};
-			unitView.notNil.if{unitView.resize_(6).align_(\left)};
+			unitView.notNil.if{unitView.resize_(6)};
 			numberView.resize_(6);
 			sliderView.resize_(5);
 			popUp.if{view.resize_(2)};
 		});
 	
 	}
-	prSubViewBounds{arg rect, hasLabel, hasUnit;
-		var numBounds,labelBounds,sliderBounds, unitBounds, gap1, gap2, gap3, tmp, labelH, unitH;
+	
+	prSubViewBounds{arg rect, hasLabel, hasUnit;  // calculate subview bounds
+		var numBounds,labelBounds,sliderBounds, unitBounds;
+		var gap1, gap2, gap3, tmp, labelH, unitH;
 		gap1 = gap;	
 		gap2 = gap1;
 		gap3 = gap1;
@@ -200,14 +204,14 @@
 				numBounds = (numberWidth@xxxxxxxxxxx).asRect; //view to left
 				(unitWidth>0).if{
 					unitBounds = Rect (numBounds.width+gap3.x, 0,
-						rect.width-numBounds.width-gap3.x,labelSize.y); //adjust width
+						rect.width-numBounds.width-gap3.x,labelSize.y); //adjust to fit
 						}{
 					unitBounds = Rect (0, 0,0,0); //no unitView
 						numBounds = (rect.width@xxxxxxxxxxx).asRect; //view to left
 						};
 						
 				};
-				sliderBounds = Rect(
+				sliderBounds = Rect( //adjust to fit
 						0,
 						labelSize.y+gap1.y,
 						rect.width, 
@@ -224,7 +228,7 @@
 				numBounds = (rect.width@xxxxxxxxxxx)
 					.asRect.top_(rect.height-unitBounds.height-numSize.y-gap3.y); // to bottom
 				
-				sliderBounds = Rect(
+				sliderBounds = Rect( //adjust to fit
 					0,
 					labelBounds.height+gap1.y, 
 					rect.width,
@@ -235,11 +239,11 @@
 				
 			 \horz, {
 				labelSize.y=view.bounds.height;
-				labelBounds = (labelSize.x@xxxxxxxxxxx).asRect;
-				unitBounds = (unitWidth@xxxxxxxxxxx).asRect.left_(rect.width-unitWidth);
+				labelBounds = (labelSize.x@xxxxxxxxxxx).asRect; //to left
+				unitBounds = (unitWidth@xxxxxxxxxxx).asRect.left_(rect.width-unitWidth); // to right 
 				numBounds = (numSize.x@xxxxxxxxxxx).asRect
-					.left_(rect.width-unitBounds.width-numSize.x-gap3.x);
-				sliderBounds  =  Rect(
+					.left_(rect.width-unitBounds.width-numSize.x-gap3.x);// to right
+				sliderBounds  =  Rect( // adjust to fit
 					labelBounds.width+gap1.x,
 					0,
 					rect.width - labelBounds.width - unitBounds.width 

Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc	2008-12-29 20:30:28 UTC (rev 8324)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc	2008-12-29 20:38:29 UTC (rev 8325)
@@ -1,12 +1,11 @@
 EZGui{ // an abstract class
-	var <>labelView, widget, <view, <gap,  <layout, <labelSize, <alwaysOnTop=false;
-	
-		
+	var <>labelView, widget, <view, <gap,  <layout, labelSize, <alwaysOnTop=false;
+			
 	visible { ^view.getProperty(\visible) }
 	visible_ { |bool|  view.setProperty(\visible,bool)  }
 	
-	enabled {  ^widget.enabled } 
-	enabled_ { |bool| widget.enabled_(bool) }
+	enabled {  ^view.enabled } 
+	enabled_ { |bool| view.enabled_(bool) }
 	
 	remove { view.remove}
 	
@@ -33,25 +32,21 @@
 		hasLabel.not.if{gap=0@0; labelSize=0@0};
 		
 		if (layout==\vert)
-			{ widgetBounds= Rect(
+			{ widgetBounds= Rect(  // fit to full width
 					0,
 					labelSize.y+gap.y,
 					rect.width,  
 					rect.height-labelSize.y-gap.y
 					);
-			if (view.parent.respondsTo(\findWindow)){
-			 tmp = view.parent.findWindow.bounds;
-			 view.parent.findWindow.bounds = tmp.height_(max(tmp.height,62+gap.y));
-			 widgetBounds = widgetBounds.height_(max(widgetBounds.height,16));
-			};
-			labelBounds=Rect(0,0,widgetBounds.width,labelSize.y);}
-			{ widgetBounds= Rect(
+			labelBounds=Rect(0,0,widgetBounds.width,labelSize.y);//fit to full width
+		}{ 
+			widgetBounds= Rect(   // fit to full remaining
 					labelSize.x+gap.x,
 					0,
 					rect.width-labelSize.x-gap.x,  
 					rect.height
 					);
-			labelBounds=Rect(0,0, labelSize.x ,widgetBounds.height )};
+			labelBounds=Rect(0,0, labelSize.x ,widgetBounds.height )}; // to left
 		
 		^[labelBounds, widgetBounds]
 	}
@@ -74,13 +69,14 @@
 	init { arg parentView, bounds, label, argItems, argGlobalAction, initVal, 
 			initAction, labelWidth, labelHeight, layout,  argGap;
 			
+		// try to use the parent decorator gap
 		var	decorator = parentView.asView.tryPerform(\decorator);
-		
 		argGap.isNil.if{ 
 			gap = decorator.tryPerform(\gap);
 			gap = gap ? (2@2)}
 			{gap=argGap};
 		
+		// init the views (hndled by subclasses)
 		this.initViews(  parentView, bounds, label, labelWidth,labelHeight,layout );
 			
 		this.items=argItems ? [];
@@ -103,7 +99,7 @@
 		};
 	}	
 	
-	initViews{}  // override this for your view
+	initViews{}  // override this for your subclass views
 	
 	value{ ^widget.value }
 	


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/