old quark gui: openOS is not osx only
[supercollider.git] / SCClassLibrary / QtCollider / QEnvelopeView.sc
blobcbf07a23af896d7c44b5c85fd0d615ea7e54f018
1 QEnvelopeView : QView
3   var <editable, <step, <grid, <gridOn = false;
4   var <gridColor, <strokeColor, <fillColor, <selectionColor;
5   var <drawLines = true, <drawRects = true;
6   var <metaAction;
8   *qtClass {^"QcGraph"}
10   editable_ { arg aBool;
11     editable = aBool;
12     this.setProperty( \editable, aBool );
13   }
15   setEditable { arg index, flag;
16     this.invokeMethod( \setEditableAt, [index, flag] );
17   }
19   step_ { arg aFloat;
20     step = aFloat;
21     this.setProperty( \step, aFloat );
22   }
24   keepHorizontalOrder {
25     ^this.getProperty( \horizontalOrder ) != 0;
26   }
28   keepHorizontalOrder_ { arg bool;
29     this.setProperty( \horizontalOrder, if(bool){1}{0} );
30   }
32   elasticSelection {
33     ^this.getProperty( \selectionForm ) == 0;
34   }
36   elasticSelection_ { arg bool;
37     this.setProperty( \selectionForm, if(bool){0}{1} );
38   }
40   value {
41     ^this.getProperty( \value );
42   }
44   value_ { arg anArray;
45     this.setProperty( \value, anArray );
46   }
48   valueAction_ { arg anArray;
49     this.setProperty( \value, anArray );
50     this.doAction;
51   }
53   index {
54     ^this.getProperty( \index );
55   }
57   index_ { arg index;
58     ^this.setProperty( \index, index );
59   }
61   lastIndex {
62     ^this.index;
63   }
65   selectIndex { arg index;
66     if( index < 0 ){
67       this.invokeMethod( \deselectAll );
68     }{
69       this.invokeMethod( \select, [index,false] );
70     };
71     this.index = index;
72   }
74   deselectIndex { arg index;
75     this.invokeMethod( \deselect, index );
76   }
78   x {
79     ^this.getProperty( \x );
80   }
82   x_ { arg aFloat;
83     this.setProperty( \x, aFloat );
84   }
86   y {
87     ^this.getProperty( \y );
88   }
90   y_ { arg aFloat;
91     this.setProperty( \y, aFloat );
92   }
94   currentvalue { ^this.y }
96   currentvalue_ { arg aFloat;
97     this.y_( aFloat );
98   }
100   setString { arg index, string;
101     this.invokeMethod( \setStringAt, [index, string] );
102   }
104   strings_ { arg anArray;
105     this.setProperty( \strings, anArray );
106   }
108   curves { this.nonimpl( "curves" ); }
110   curves_ { arg curves;
111     this.invokeMethod( \setCurves,
112       if(curves.size > 0) { [curves.collect{|c| QCurve(c)}] } { QCurve(curves) }
113     );
114   }
116   setEnv { arg env;
117     var times = [0] ++ env.times.integrate;
118     if( times.last > 0 ) {times = times / times.last};
119     this.value = [times, env.levels];
120     this.curves = env.curves;
121   }
123   grid_ { arg aPoint;
124     grid = aPoint;
125     this.setProperty( \grid, aPoint );
126   }
128   gridOn_ { arg aBool;
129     gridOn = aBool;
130     this.setProperty( \gridOn, aBool );
131   }
133   gridColor_ { arg aColor;
134     gridColor = aColor;
135     this.setProperty( \gridColor, aColor );
136   }
138   connect { arg source, targets;
139     this.invokeMethod( \connectElements, [source, targets] );
140   }
142   strokeColor_ { arg aColor;
143     strokeColor = aColor;
144     this.setProperty( \strokeColor, aColor );
145   }
147   background {
148     ^this.palette.baseColor;
149   }
151   background_ { arg color;
152     this.palette = this.palette.baseColor_(color);
153   }
155   fillColor_ { arg aColor;
156     fillColor = aColor;
157     this.setProperty( \fillColor, aColor );
158   }
160   setFillColor { arg index, color;
161     this.invokeMethod( \setFillColorAt, [index, color] );
162   }
164   colors_ { arg strokeColor, fillColor;
165     this.strokeColor_( strokeColor );
166     this.fillColor_( fillColor );
167   }
169   selectionColor_ { arg aColor;
170     selectionColor = aColor;
171     this.setProperty( \selectionColor, aColor );
172   }
174   drawLines_ { arg aBool;
175     drawLines = aBool;
176     this.setProperty( \drawLines, aBool );
177   }
179   drawRects_ { arg aBool;
180     drawRects = aBool;
181     this.setProperty( \drawRects, aBool );
182   }
184   thumbWidth_ { arg aFloat;
185     this.setProperty( \thumbWidth, aFloat; );
186   }
188   thumbHeight_ { arg aFloat;
189     this.setProperty( \thumbHeight, aFloat; );
190   }
192   thumbSize_ { arg aFloat;
193     this.setProperty( \thumbSize, aFloat; );
194   }
196   setThumbWidth { this.nonimpl("setThumbWidth"); }
198   setThumbHeight { this.nonimpl("setThumbHeight"); }
200   setThumbSize { this.nonimpl("setThumbSize"); }
202   metaAction_ { arg function;
203     this.manageMethodConnection( metaAction, function, 'metaAction()', \doMetaAction );
204     metaAction = function;
205   }
207   doMetaAction {
208     metaAction.value(this);
209   }
211   defaultGetDrag {
212     ^this.value;
213   }
214   defaultCanReceiveDrag { ^true; }
215   defaultReceiveDrag {
216     this.value = QView.currentDrag;
217   }