X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_UIImplementation.pde;h=1257f6fffd435068e0387f860174dedbbe2eeaf7;hb=3f16fd027656eaca0ed62f9c90c4da56385bb3bf;hp=9fbc8762b958de32e04711c3345dad82a38711fd;hpb=4e6626a95f23831319a73d3702789621b2248bb9;p=SugarCubes.git diff --git a/_UIImplementation.pde b/_UIImplementation.pde index 9fbc876..1257f6f 100644 --- a/_UIImplementation.pde +++ b/_UIImplementation.pde @@ -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 items = new ArrayList(); - 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); } } @@ -163,17 +166,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 items = new ArrayList(); - 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 +184,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.setValue(!isSelected()); } } } @@ -281,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;