Remove transition management from glucose
[SugarCubes.git] / _UIImplementation.pde
index 32c654e2b0f269939c1c1b5d4682de4856f5b02a..1257f6fffd435068e0387f860174dedbbe2eeaf7 100644 (file)
@@ -15,8 +15,9 @@ class UIBlendMode extends UIWindow {
   public UIBlendMode(float x, float y, float w, float h) {
     super(lx.ui, "BLEND MODE", x, y, w, h);
     List<UIScrollList.Item> items = new ArrayList<UIScrollList.Item>();
-    for (LXTransition t : glucose.getTransitions()) {
-      items.add(new TransitionScrollItem(t));
+    int i = 0;
+    for (LXTransition t : transitions) {
+      items.add(new TransitionScrollItem(t, i++));
     }
     final UIScrollList tList;
     (tList = new UIScrollList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 60)).setItems(items).addToContainer(this);
@@ -30,11 +31,13 @@ class UIBlendMode extends UIWindow {
 
   class TransitionScrollItem extends UIScrollList.AbstractItem {
     private final LXTransition transition;
-    private String label;
+    private final int index;
+    private final String label;
     
-    TransitionScrollItem(LXTransition transition) {
+    TransitionScrollItem(LXTransition transition, int index) {
       this.transition = transition;
-      label = className(transition, "Transition");
+      this.index = index;
+      this.label = className(transition, "Transition");
     }
     
     public String getLabel() {
@@ -42,7 +45,7 @@ class UIBlendMode extends UIWindow {
     }
     
     public boolean isSelected() {
-      return transition == glucose.getSelectedTransition();
+      return index == activeTransition.getValuei();
     }
     
     public boolean isPending() {
@@ -50,7 +53,7 @@ class UIBlendMode extends UIWindow {
     }
     
     public void onMousePressed() {
-      glucose.setSelectedTransition(transition);
+      activeTransition.setValue(this.index);
     }
   }
 
@@ -197,7 +200,7 @@ class UIOutput extends UIWindow {
     }
     
     public void onMousePressed() {
-      output.enabled.setOn(!isSelected());
+      output.enabled.setValue(!isSelected());
     }
   } 
 }
@@ -273,7 +276,7 @@ class UIMapping extends UIWindow {
       protected void onValueChange(int value) {
         mappingTool.setChannel(value-1);
       }
-    }).setRange(0, mappingTool.numChannels()).addToContainer(this);
+    }).setRange(1, mappingTool.numChannels()).addToContainer(this);
     yp += 24;
     
     new UILabel(4, yp+8, w-10, 20).setLabel("CUBE ID").addToContainer(this);
@@ -282,7 +285,7 @@ class UIMapping extends UIWindow {
       protected void onValueChange(int value) {
         mappingTool.setCube(value-1);
       }
-    }).setRange(1, glucose.model.cubes.size()).addToContainer(this);
+    }).setRange(1, model.cubes.size()).addToContainer(this);
     yp += 24;
     
     yp += 10;