new UIPatternDeck(lx.engine.getDeck(1), "PATTERN B", width-144, 4, 140, 344),
new UIEffects(width-144, 352, 140, 144),
new UITempo(width-144, 498, 140, 50),
- new UIOutput(width-144, 552, 140, 122),
+ new UIOutput(width-144, 552, 140, 106),
uiDebugText = new UIDebugText(4, height-64, width-8, 44),
uiMapping = new UIMapping(mappingTool, 4, 4, 140, 344),
}
}
}
+
+ public boolean isEnabled() {
+ return this.enabled;
+ }
public void disable() {
setEnabled(false);
itemColor = pendingColor;
} else {
labelColor = #000000;
- itemColor = even ? #666666 : #777777;
+ itemColor = #707070;
}
+ float factor = even ? .92 : 1.08;
+ itemColor = color(hue(itemColor), saturation(itemColor), min(100, factor*brightness(itemColor)));
+
pg.noStroke();
pg.fill(itemColor);
pg.rect(0, yp, w, itemHeight);
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<ScrollItem> items = new ArrayList<ScrollItem>();
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 select() {
+ panda.toggle();
+ }
+ }
}
class UITempo extends UIWindow {