X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_UIImplementation.pde;h=a12c189219ba646d563f459608a508d7519a4209;hb=30bf6510d87dbce8e36b03564807c1a5f4718f9d;hp=e72d76b598976e164a04c78a0e9cb1fe7bd48627;hpb=179b1fb4846e67cbbcc868ffaec59aadace5893d;p=SugarCubes.git diff --git a/_UIImplementation.pde b/_UIImplementation.pde index e72d76b..a12c189 100644 --- a/_UIImplementation.pde +++ b/_UIImplementation.pde @@ -483,16 +483,27 @@ class UIMidi extends UIWindow { private final UIToggleSet deckMode; private final UIButton logMode; - UIMidi(List midiListeners, float x, float y, float w, float h) { + UIMidi(List midiControllers, 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); + for (SCMidiInput mc : midiControllers) { + scrollItems.add(mc); } - new UIScrollList(1, titleHeight, w-2, 100).setItems(scrollItems).addToContainer(this); + final UIScrollList scrollList; + (scrollList = new UIScrollList(1, titleHeight, w-2, 100)).setItems(scrollItems).addToContainer(this); (deckMode = new UIToggleSet(4, 130, 90, 20)).setOptions(new String[] { "A", "B" }).addToContainer(this); (logMode = new UIButton(98, 130, w-103, 20)).setLabel("LOG").addToContainer(this); + + SCMidiInputListener listener = new SCMidiInputListener() { + public void onEnabled(SCMidiInput controller, boolean enabled) { + scrollList.redraw(); + } + }; + for (SCMidiInput mc : midiControllers) { + mc.addListener(listener); + } + } public boolean logMidi() {