Created
October 8, 2011 06:37
-
-
Save danmackinlay/1271949 to your computer and use it in GitHub Desktop.
autoGui ArrayWarp vs PresetInterpolator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- quarks/autogui/Classes/ArrayWarp.sc 2011-09-30 21:01:01.000000000 +1000 | |
+++ /Volumes/dan/src/sc/mmExtensions/interpolator/ArrayWarp.sc 2011-10-08 14:29:22.000000000 +1100 | |
@@ -1,3 +1,3 @@ | |
-// by Martin Marier | |
+// Copyright 2010 Martin Marier | |
ArrayWarp : LinearWarp { | |
@@ -36,5 +36,5 @@ | |
w.addFlowLayout( 10@10, 5@2 ); | |
ms = MultiSliderView(w, 330@330) | |
- .resize_(1) | |
+ .resize_(5) | |
.elasticMode_(1) | |
.indexThumbSize_(50) | |
@@ -124,53 +124,53 @@ | |
widgets = [ | |
NumberBox(w, 40@18).value_(this.minval) | |
- .action_({|i| | |
- this.minval_(i.value); | |
- this.init; | |
- this.warp.class.switch( | |
- CurveWarp, { this.warp.init(curve.value) } | |
- ); | |
- action.value(this); | |
- }), | |
+ .action_({|i| | |
+ this.minval_(i.value); | |
+ this.init; | |
+ this.warp.class.switch( | |
+ CurveWarp, { this.warp.init(curve.value) } | |
+ ); | |
+ action.value(this); | |
+ }), | |
NumberBox(w, 40@18).value_(this.maxval) | |
- .action_({|i| | |
- this.maxval_(i.value); | |
- this.init; | |
- this.warp.class.switch( | |
- CurveWarp, { this.warp.init(curve.value) } | |
- ); | |
- action.value(this); | |
- }), | |
+ .action_({|i| | |
+ this.maxval_(i.value); | |
+ this.init; | |
+ this.warp.class.switch( | |
+ CurveWarp, { this.warp.init(curve.value) } | |
+ ); | |
+ action.value(this); | |
+ }), | |
PopUpMenu(w, 40@18).items_(Warp.warps.keys.asArray ++ [\curve]) | |
- .value_( | |
- if (this.warp.class == CurveWarp) { | |
- Warp.warps.keys.asArray.size; | |
- }{ | |
- Warp.warps.keys.asArray.indexOf(this.warp.asSpecifier) | |
- } | |
- ) | |
- .action_({|i| | |
- try {this.warp.w.close}; | |
- if (i.item == \curve) { | |
- curve.enabled_(true); | |
- this.warp_(curve.value.asWarp(this)); | |
- this.init; | |
- this.warp.init(curve.value); | |
- }{ | |
- curve.enabled_(false); | |
- this.warp_(i.item.asWarp(this)); | |
+ .value_( | |
+ if (this.warp.class == CurveWarp) { | |
+ Warp.warps.keys.asArray.size; | |
+ }{ | |
+ Warp.warps.keys.asArray.indexOf(this.warp.asSpecifier) | |
+ } | |
+ ) | |
+ .action_({|i| | |
+ try {this.warp.w.close}; | |
+ if (i.item == \curve) { | |
+ curve.enabled_(true); | |
+ this.warp_(curve.value.asWarp(this)); | |
+ this.init; | |
+ this.warp.init(curve.value); | |
+ }{ | |
+ curve.enabled_(false); | |
+ this.warp_(i.item.asWarp(this)); | |
+ this.init; | |
+ if (i.item == \array) { | |
this.init; | |
- if (i.item == \array) { | |
- this.init; | |
- this.warp.init; | |
- this.warp.makeWindow( | |
- w.bounds.left + 290, | |
- w.bounds.top, | |
- action, | |
- name | |
- ); | |
- } | |
- }; | |
- action.value(this); | |
- }), | |
+ this.warp.init; | |
+ this.warp.makeWindow( | |
+ w.bounds.left + 290, | |
+ w.bounds.top, | |
+ action, | |
+ name | |
+ ); | |
+ } | |
+ }; | |
+ action.value(this); | |
+ }), | |
NumberBox(w, 40@18).value_(this.step) | |
.action_({|i| | |
@@ -229,8 +229,7 @@ | |
try {this.warp.w.close}; | |
if (i.value != 0) { | |
- // Default step = 0 is unfortunate, would be better 1 | |
args = i.item.asSymbol.asSpec.storeArgs; | |
widgets.do({ |j,k| | |
- if (k == 2) { | |
+ if (k == 2) {// set the warp type | |
j.value_( | |
Warp.warps.keys.asArray.indexOf( | |
@@ -244,9 +243,9 @@ | |
}); | |
}; | |
- action.value; | |
+ action.value(this); | |
}); | |
w.front; | |
w.onClose_({ | |
- try {this.warp.w.close}; | |
+ try {warp.w.close}; | |
}); | |
^w; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment