X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_UIImplementation.pde;h=226c68a124655f5312c8d2fdcb58734e25086d96;hb=a8d55ade10d68a95188105282c2c453816b20708;hp=c223444ef2eb81f0831a96e269cbd2bbea76224c;hpb=34327c962351112e07c3d93f56ffc543fac45b58;p=SugarCubes.git diff --git a/_UIImplementation.pde b/_UIImplementation.pde index c223444..226c68a 100644 --- a/_UIImplementation.pde +++ b/_UIImplementation.pde @@ -24,7 +24,7 @@ class UIPatternDeck extends UIWindow { for (LXPattern p : deck.getPatterns()) { items.add(new PatternScrollItem(p)); } - final UIScrollList patternList = new UIScrollList(1, yp, w-2, 160).setItems(items); + final UIScrollList patternList = new UIScrollList(1, yp, w-2, 140).setItems(items); patternList.addToContainer(this); yp += patternList.h + 10; @@ -86,57 +86,64 @@ class UIPatternDeck extends UIWindow { } } -class UICrossfader extends UIWindow { - - private final UIToggleSet displayMode; - - public UICrossfader(float x, float y, float w, float h) { - super("CROSSFADER", x, y, w, h); - +class UIBlendMode extends UIWindow { + public UIBlendMode(float x, float y, float w, float h) { + super("BLEND MODE", x, y, w, h); List items = new ArrayList(); for (LXTransition t : glucose.getTransitions()) { items.add(new TransitionScrollItem(t)); } 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); - + (tList = new UIScrollList(1, titleHeight, w-2, 60)).setItems(items).addToContainer(this); + lx.engine.getDeck(1).addListener(new Engine.AbstractListener() { public void blendTransitionDidChange(Engine.Deck deck, LXTransition transition) { tList.redraw(); } }); } - - public String getDisplayMode() { - return displayMode.getValue(); + + class TransitionScrollItem extends AbstractScrollItem { + private final LXTransition transition; + private String label; + + TransitionScrollItem(LXTransition transition) { + this.transition = transition; + label = className(transition, "Transition"); + } + + public String getLabel() { + return label; + } + + public boolean isSelected() { + return transition == glucose.getSelectedTransition(); + } + + public boolean isPending() { + return false; + } + + public void onMousePressed() { + glucose.setSelectedTransition(transition); + } } + } -class TransitionScrollItem extends AbstractScrollItem { - private final LXTransition transition; - private String label; - - TransitionScrollItem(LXTransition transition) { - this.transition = transition; - label = className(transition, "Transition"); - } - - public String getLabel() { - return label; - } +class UICrossfader extends UIWindow { - public boolean isSelected() { - return transition == glucose.getSelectedTransition(); - } + private final UIToggleSet displayMode; - public boolean isPending() { - return false; + public UICrossfader(float x, float y, float w, float h) { + super("CROSSFADER", x, y, w, h); + + new UIParameterSlider(4, titleHeight, w-9, 32).setParameter(lx.engine.getDeck(1).getCrossfader()).addToContainer(this); + (displayMode = new UIToggleSet(4, titleHeight + 36, w-9, 20)).setOptions(new String[] { "A", "COMP", "B" }).setValue("COMP").addToContainer(this); } - public void onMousePressed() { - glucose.setSelectedTransition(transition); + public String getDisplayMode() { + return displayMode.getValue(); } } @@ -336,9 +343,8 @@ class UIMapping extends UIWindow { }).setRange(1, glucose.model.cubes.size()).addToContainer(this); yp += 24; - new UILabel(4, yp+8, w-10, 20).setLabel("COLORS").addToContainer(this); - yp += 24; - + yp += 10; + new UIScrollList(1, yp, w-2, 60).setItems(Arrays.asList(new ScrollItem[] { new ColorScrollItem(ColorScrollItem.COLOR_RED), new ColorScrollItem(ColorScrollItem.COLOR_GREEN), @@ -411,7 +417,7 @@ class UIMapping extends UIWindow { return false; } - public void select() { + public void onMousePressed() { switch (colorChannel) { case COLOR_RED: mappingTool.channelModeRed = !mappingTool.channelModeRed; break; case COLOR_GREEN: mappingTool.channelModeGreen = !mappingTool.channelModeGreen; break; @@ -451,6 +457,7 @@ class UIDebugText extends UIContext { pg.fill(#444444); pg.rect(0, 0, w, h); pg.textFont(defaultItemFont); + pg.textSize(10); pg.textAlign(LEFT, TOP); pg.fill(#cccccc); pg.text(line1, 4, 4); @@ -471,6 +478,26 @@ class UISpeed extends UIWindow { } } +class UIMidi extends UIWindow { + + final private UIToggleSet deckMode; + + UIMidi(List midiListeners, float x, float y, float w, float h) { + super("MIDI", x, y, w, h); + // Processing compiler doesn't seem to get that list of class objects also conform to interface + List scrollItems = new ArrayList(); + for (MidiListener ml : midiListeners) { + scrollItems.add(ml); + } + new UIScrollList(1, titleHeight, w-2, 80).setItems(scrollItems).addToContainer(this); + (deckMode = new UIToggleSet(4, 110, w-9, 20)).setOptions(new String[] { "A", "B" }).addToContainer(this); + } + + public Engine.Deck getFocusedDeck() { + return lx.engine.getDeck(deckMode.getValue() == "A" ? 0 : 1); + } +} + String className(Object p, String suffix) { String s = p.getClass().getName(); int li;