X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_UIImplementation.pde;h=d25df48ade2c65802c5d7daebcdf7572953a8d5d;hb=a898d79bac007404bed34365f31ffbc6480c901c;hp=3d4940fe2a615b16a23f18eeab1b734bd41dd0db;hpb=78a44a1ba9c18a8293e1a3445938a2dd7469015c;p=SugarCubes.git diff --git a/_UIImplementation.pde b/_UIImplementation.pde index 3d4940f..d25df48 100644 --- a/_UIImplementation.pde +++ b/_UIImplementation.pde @@ -34,7 +34,7 @@ class UIPatternDeck extends UIWindow { parameterKnobs[ki].addToContainer(this); } - Engine.Listener lxListener = new Engine.Listener() { + Engine.Listener lxListener = new Engine.AbstractListener() { public void patternWillChange(Engine.Deck deck, LXPattern pattern, LXPattern nextPattern) { patternList.redraw(); } @@ -80,28 +80,37 @@ class UIPatternDeck extends UIWindow { return deck.getNextPattern() == pattern; } - public void select() { + public void onMousePressed() { deck.goPattern(pattern); } } } class UICrossfader extends UIWindow { - + + private final UIToggleSet displayMode; + public UICrossfader(float x, float y, float w, float h) { super("CROSSFADER", x, y, w, h); List items = new ArrayList(); - for (LXTransition t : transitions) { + for (LXTransition t : glucose.getTransitions()) { items.add(new TransitionScrollItem(t)); - } - new UIScrollList(1, titleHeight, w-2, 60).setItems(items).addToContainer(this); - new UIParameterSlider(4, titleHeight + 66, w-10, 24).setParameter(lx.engine.getDeck(1).getCrossfader()).addToContainer(this); - new UIToggleSet(4, 122, w-10, 20) { - protected void onToggle(String value) { - displayMode = value; + } + final UIScrollList tList; + (tList = new UIScrollList(1, titleHeight, w-2, 120)).setItems(items).addToContainer(this); + new UIParameterSlider(4, titleHeight + 126, w-10, 24).setParameter(lx.engine.getDeck(1).getCrossfader()).addToContainer(this); + (displayMode = new UIToggleSet(4, 182, w-10, 20)).setOptions(new String[] { "A", "COMP", "B" }).setValue("COMP").addToContainer(this); + + lx.engine.getDeck(1).addListener(new Engine.AbstractListener() { + public void blendTransitionDidChange(Engine.Deck deck, LXTransition transition) { + tList.redraw(); } - }.setOptions(new String[] { "A", "COMP", "B" }).setValue(displayMode = "COMP").addToContainer(this); + }); + } + + public String getDisplayMode() { + return displayMode.getValue(); } } @@ -119,15 +128,15 @@ class TransitionScrollItem extends AbstractScrollItem { } public boolean isSelected() { - return transition == lx.engine.getDeck(1).getBlendTransition(); + return transition == glucose.getSelectedTransition(); } public boolean isPending() { return false; } - public void select() { - lx.engine.getDeck(1).setBlendTransition(transition); + public void onMousePressed() { + glucose.setSelectedTransition(transition); } } @@ -192,10 +201,6 @@ class UIEffects extends UIWindow { return effect.isEnabled(); } - public void select() { - glucose.setSelectedEffect(effect); - } - public void onMousePressed() { if (glucose.getSelectedEffect() == effect) { if (effect.isMomentary()) { @@ -203,6 +208,8 @@ class UIEffects extends UIWindow { } else { effect.toggle(); } + } else { + glucose.setSelectedEffect(effect); } } @@ -220,21 +227,39 @@ class UIOutput extends UIWindow { public UIOutput(float x, float y, float w, float h) { super("OUTPUT", x, y, w, h); float yp = titleHeight; + + final UIScrollList outputs = new UIScrollList(1, titleHeight, w-2, 80); + + List items = new ArrayList(); for (final PandaDriver panda : pandaBoards) { - final UIButton button = new UIButton(4, yp, w-10, 20) { - protected void onToggle(boolean active) { - panda.setEnabled(active); - } - }.setLabel(panda.ip); - button.addToContainer(this); + items.add(new PandaScrollItem(panda)); panda.setListener(new PandaDriver.Listener() { public void onToggle(boolean active) { - button.setActive(active); + outputs.redraw(); } }); - yp += 24; } - } + outputs.setItems(items).addToContainer(this); + } + + class PandaScrollItem extends AbstractScrollItem { + final PandaDriver panda; + PandaScrollItem(PandaDriver panda) { + this.panda = panda; + } + + public String getLabel() { + return panda.ip; + } + + public boolean isSelected() { + return panda.isEnabled(); + } + + public void onMousePressed() { + panda.toggle(); + } + } } class UITempo extends UIWindow {