[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[8260] trunk/build/SCClassLibrary/Common/GUI/Base
Revision: 8260
http://supercollider.svn.sourceforge.net/supercollider/?rev=8260&view=rev
Author: jmfuo
Date: 2008-12-23 15:14:46 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
new EZ stuff
Modified Paths:
--------------
trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc
trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc
trunk/build/SCClassLibrary/Common/GUI/Base/EZextensions.sc
trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc
Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc 2008-12-23 15:14:20 UTC (rev 8259)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZListView.sc 2008-12-23 15:14:46 UTC (rev 8260)
@@ -1,26 +1,20 @@
-EZListView : EZlists{
- *new { arg parentView, bounds, label,items, globalAction, initVal=0,
- initAction=false, labelWidth=80, labelHeight=20, labelPosition=\top, gap=4;
-
- ^super.new.init(parentView, bounds, label, items, globalAction, initVal,
- initAction, labelWidth,labelHeight,labelPosition, gap);
- }
-
-
- init { arg parentView, bounds, label, argItems, argGlobalAction, initVal,
- initAction, labelWidth, labelHeight, arglabelPosition, argGap;
- var labelBounds, listBounds,w, winBounds;
+EZListView : EZLists{
+
+ initViews{ arg parentView, bounds, label, labelWidth,argLabelPosition;
+ var labelBounds, listBounds,w, winBounds, labelHeight;
+
bounds.isNil.if{bounds= 160@200};
- labelPosition=arglabelPosition;
+ labelWidth = labelWidth ? 80;
+ labelHeight = 20;
+ labelPosition=argLabelPosition ? \top;
labelSize=labelWidth@labelHeight;
- gap=argGap;
-
+
parentView.isNil.if{
if (bounds.class==Point){
winBounds=Rect(200, Window.screenBounds.height-bounds.y-100,
bounds.x,bounds.y)
}{winBounds=bounds};
- w = GUI.window.new("",winBounds);
+ w = GUI.window.new("",winBounds).alwaysOnTop_(alwaysOnTop);
parentView=w.asView;
w.front;
bounds=bounds.asRect;
@@ -31,6 +25,7 @@
bounds=bounds.asRect;
view=GUI.compositeView.new(parentView,bounds).relativeOrigin_(true);
};
+ view.decorator=FlowLayout(view.bounds,0@0,0@0);
# labelBounds,listBounds = this.prSubViewBounds(bounds, label.notNil);
@@ -46,27 +41,8 @@
};
widget = GUI.listView.new(view, listBounds).resize_(5);
-
- this.items=argItems ? [];
-
- globalAction=argGlobalAction;
-
- widget.action={arg obj;
- items.at(obj.value).value.value(obj);
- globalAction.value(obj);
- };
-
- this.value_(initVal);
-
- items.notNil.if{
- if(initAction){
- items.at(initVal).value.value(this); // You must do this like this
- globalAction.value(this); // since listView's array is not accessible yet
- }
- {this.value_(initVal)};
- };
- }
-
+ }
+
listView{^widget}
}
Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc 2008-12-23 15:14:20 UTC (rev 8259)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZPopUpMenu.sc 2008-12-23 15:14:46 UTC (rev 8260)
@@ -1,18 +1,14 @@
-EZPopUpMenu : EZlists{
+EZPopUpMenu : EZLists{
- *new { arg parentView, bounds, label,items, globalAction, initVal=0,
- initAction=false, labelWidth=80, labelHeight=20, labelPosition=\left, gap=4;
-
- ^super.new.init(parentView, bounds, label, items, globalAction, initVal,
- initAction, labelWidth,labelHeight,labelPosition, gap);
- }
- init { arg parentView, bounds, label, argItems, argGlobalAction, initVal,
- initAction, labelWidth, labelHeight, arglabelPosition, argGap;
- var labelBounds, listBounds,w, winBounds;
- labelPosition=arglabelPosition;
+
+ initViews{ arg parentView, bounds, label, labelWidth,argLabelPosition;
+ var labelBounds, listBounds,w, winBounds, labelHeight;
+
+ labelWidth = labelWidth ? 80;
+ labelHeight= 20;
+ labelPosition=argLabelPosition ? \left;
labelSize=labelWidth@labelHeight;
- gap=argGap;
parentView.isNil.if{
bounds.isNil.if{bounds= 160@44};
@@ -20,7 +16,7 @@
winBounds=Rect(200, Window.screenBounds.height-bounds.y-100,
bounds.x,bounds.y)
}{winBounds=bounds};
- w = GUI.window.new("",winBounds);
+ w = GUI.window.new("",winBounds).alwaysOnTop_(alwaysOnTop);
parentView=w.asView;
w.front;
bounds=bounds.asRect;
@@ -46,26 +42,7 @@
};
widget = GUI.popUpMenu.new(view, listBounds).resize_(5);
-
- this.items=argItems ? [];
-
- globalAction=argGlobalAction;
-
- widget.action={arg obj;
- items.at(obj.value).value.value(obj);
- globalAction.value(obj);
- };
-
- this.value_(initVal);
-
- items.notNil.if{
- if(initAction){
- items.at(initVal).value.value(this); // You must do this like this
- globalAction.value(this); // since listView's array is not accessible yet
- }
- {this.value_(initVal)};
- };
- }
+ }
menu {^ widget}
}
Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZextensions.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZextensions.sc 2008-12-23 15:14:20 UTC (rev 8259)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZextensions.sc 2008-12-23 15:14:46 UTC (rev 8260)
@@ -1,4 +1,4 @@
-EZSlider
+EZSliderXX
{
var <>labelView, <>sliderView, <>numberView, <>controlSpec, <>action, <value;
var <>round = 0.001;
@@ -87,7 +87,7 @@
-EZNumber
+EZNumberXX
{
var <>labelView, <>numberView, <>controlSpec, <>action, <value;
var <>round = 0.001;
Modified: trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc 2008-12-23 15:14:20 UTC (rev 8259)
+++ trunk/build/SCClassLibrary/Common/GUI/Base/EZgui.sc 2008-12-23 15:14:46 UTC (rev 8260)
@@ -1,7 +1,5 @@
-EZgui{
- var <>labelView, <widget, <view, <gap, <labelPosition, labelSize, value;
-
- /////////////////////////
+EZGui{ // an abstract class
+ var <>labelView, <widget, <view, <gap, <labelPosition, labelSize, <>alwaysOnTop=true;
label_{ arg string;
@@ -23,8 +21,8 @@
}
- label { arg label, items, globalAction;
- labelView.string;
+ label {
+ ^labelView.string;
}
visible { ^view.getProperty(\visible) }
@@ -91,40 +89,75 @@
tempGap=gap;
hasLabel.not.if{tempGap=0; labelSize=0@0};
- if (labelPosition==\top,{
- listBounds= Rect(
+ if (labelPosition==\top)
+ { listBounds= Rect(
0,
labelSize.y+tempGap,
view.bounds.width,
view.bounds.height-labelSize.y-tempGap
);
- labelBounds=Rect(0,0,listBounds.width,labelSize.y);
- },{
- listBounds= Rect(
+ labelBounds=Rect(0,0,listBounds.width,labelSize.y);}
+ { listBounds= Rect(
labelSize.x+tempGap,
0,
view.bounds.width-labelSize.x-tempGap,
view.bounds.height
);
- labelBounds=Rect(0,0, labelSize.x ,listBounds.height );
- });
+ labelBounds=Rect(0,0, labelSize.x ,listBounds.height )};
^[labelBounds, listBounds]
}
-
-
-
-
- /////////////////////////
}
-EZlists : EZgui{
- var <items, <>globalAction ;
+EZLists : EZGui{ // an abstract class
+
+ var <items, <>globalAction, value;
+ *new { arg parentView, bounds, label,items, globalAction, initVal=0,
+ initAction=false, labelWidth, labelPosition, gap;
+
+ ^super.new.init(parentView, bounds, label, items, globalAction, initVal,
+ initAction, labelWidth,labelPosition, gap);
+ }
+
+ init { arg parentView, bounds, label, argItems, argGlobalAction, initVal,
+ initAction, labelWidth, labelPosition, argGap;
+
+ var decorator = parentView.asView.tryPerform(\decorator);
+
+ argGap.isNil.if
+ {gap = decorator.tryPerform(\gap).tryPerform(\x)}
+ {gap = argGap};
+ gap = gap ? 2;
+
+ this.initViews( parentView, bounds, label, labelWidth,labelPosition );
+
+ this.items=argItems ? [];
+
+ globalAction=argGlobalAction;
+
+ widget.action={arg obj;
+ items.at(obj.value).value.value(obj);
+ globalAction.value(obj);
+ };
+
+ this.value_(initVal);
+
+ items.notNil.if{
+ if(initAction){
+ items.at(initVal).value.value(this); // You must do this like this
+ globalAction.value(this); // since listView's array is not accessible yet
+ }
+ {this.value_(initVal)};
+ };
+ }
+ initViews{ arg parentView, bounds, label, labelWidth, labelHeight,argLabelPosition;
+ var labelBounds, listBounds,w, winBounds;
+ }
value{ ^widget.value }
value_{|val| widget.value_(val)}
@@ -157,8 +190,3 @@
}
-
-EZValues : EZgui{
- /// EZSlider, EZRanger EZNumber support
-
-}
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/