Lots of code cleanup, removed Panda code, all grizzly, cleaning up mapping
[SugarCubes.git] / _UIImplementation.pde
index 9fbc8762b958de32e04711c3345dad82a38711fd..32c654e2b0f269939c1c1b5d4682de4856f5b02a 100644 (file)
@@ -163,17 +163,17 @@ class UIEffects extends UIWindow {
 }
 
 class UIOutput extends UIWindow {
-  public UIOutput(float x, float y, float w, float h) {
+  public UIOutput(GrizzlyOutput[] grizzlies, float x, float y, float w, float h) {
     super(lx.ui, "OUTPUT", x, y, w, h);
     float yp = UIWindow.TITLE_LABEL_HEIGHT;
     
     final UIScrollList outputs = new UIScrollList(1, UIWindow.TITLE_LABEL_HEIGHT, w-2, 80);
     
     List<UIScrollList.Item> items = new ArrayList<UIScrollList.Item>();
-    for (final PandaDriver panda : pandaBoards) {
-      items.add(new PandaScrollItem(panda));
-      panda.setListener(new PandaDriver.Listener() {
-        public void onToggle(boolean active) {
+    for (GrizzlyOutput grizzly : grizzlies) {
+      items.add(new GrizzlyScrollItem(grizzly));
+      grizzly.enabled.addListener(new LXParameterListener() {
+        public void onParameterChanged(LXParameter parameter) {
            outputs.redraw();
         }
       });
@@ -181,22 +181,23 @@ class UIOutput extends UIWindow {
     outputs.setItems(items).addToContainer(this);
   } 
  
-  class PandaScrollItem extends UIScrollList.AbstractItem {
-    final PandaDriver panda;
-    PandaScrollItem(PandaDriver panda) {
-      this.panda = panda;
+  class GrizzlyScrollItem extends UIScrollList.AbstractItem {
+    final GrizzlyOutput output;
+
+    GrizzlyScrollItem(GrizzlyOutput output) {
+      this.output = output;
     }
     
     public String getLabel() {
-      return panda.ip;
+      return output.ipAddress;
     }
     
     public boolean isSelected() {
-      return panda.isEnabled();
+      return output.enabled.isOn();
     }
     
     public void onMousePressed() {
-      panda.toggle();
+      output.enabled.setOn(!isSelected());
     }
   } 
 }
@@ -272,7 +273,7 @@ class UIMapping extends UIWindow {
       protected void onValueChange(int value) {
         mappingTool.setChannel(value-1);
       }
-    }).setRange(1, mappingTool.numChannels()).addToContainer(this);
+    }).setRange(0, mappingTool.numChannels()).addToContainer(this);
     yp += 24;
     
     new UILabel(4, yp+8, w-10, 20).setLabel("CUBE ID").addToContainer(this);