Search in sources :

Example 1 with Pair

use of de.mossgrabers.framework.utils.Pair in project DrivenByMoss by git-moss.

the class AbstractGraphicDisplay method addListElement.

/**
 * {@inheritDoc}
 */
@Override
public void addListElement(final String[] items, final boolean[] selected) {
    final List<Pair<String, Boolean>> menu = new ArrayList<>();
    for (int i = 0; i < items.length; i++) menu.add(new Pair<>(items[i], Boolean.valueOf(selected[i])));
    this.addElement(new ListComponent(menu));
}
Also used : ArrayList(java.util.ArrayList) ClipListComponent(de.mossgrabers.framework.graphics.canvas.component.ClipListComponent) ListComponent(de.mossgrabers.framework.graphics.canvas.component.ListComponent) Pair(de.mossgrabers.framework.utils.Pair)

Example 2 with Pair

use of de.mossgrabers.framework.utils.Pair in project DrivenByMoss by git-moss.

the class SessionMode method updateDisplay2Clips.

private void updateDisplay2Clips(final IGraphicDisplay display) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final int numTracks = tb.getPageSize();
    final int numScenes = tb.getSceneBank().getPageSize();
    final boolean flipSession = this.surface.getConfiguration().isFlipSession();
    final int maxCols = flipSession ? numScenes : numTracks;
    int maxRows = flipSession ? numTracks : numScenes;
    if (this.rowDisplayMode != RowDisplayMode.ALL)
        maxRows = maxRows / 2;
    for (int col = 0; col < maxCols; col++) {
        final List<Pair<ITrack, ISlot>> slots = new ArrayList<>(maxRows);
        for (int row = 0; row < maxRows; row++) {
            int x = flipSession ? row : col;
            int y = flipSession ? col : row;
            if (this.rowDisplayMode == RowDisplayMode.LOWER) {
                if (flipSession)
                    x += maxRows;
                else
                    y += maxRows;
            }
            final ITrack track = tb.getItem(x);
            slots.add(new Pair<>(track, track.getSlotBank().getItem(y)));
        }
        display.addSlotListElement(slots);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ArrayList(java.util.ArrayList) Pair(de.mossgrabers.framework.utils.Pair)

Example 3 with Pair

use of de.mossgrabers.framework.utils.Pair in project DrivenByMoss by git-moss.

the class AbstractGraphicDisplay method addListElement.

/**
 * {@inheritDoc}
 */
@Override
public void addListElement(final int displaySize, final String[] elements, final int selectedIndex) {
    final List<Pair<String, Boolean>> menu = new ArrayList<>();
    final int startIndex = Math.max(0, Math.min(selectedIndex, elements.length - displaySize));
    for (int i = 0; i < displaySize; i++) {
        final int pos = startIndex + i;
        final String itemName = pos < elements.length ? elements[pos] : "";
        menu.add(new Pair<>(itemName, Boolean.valueOf(pos == selectedIndex)));
    }
    this.addElement(new ListComponent(menu));
}
Also used : ArrayList(java.util.ArrayList) ClipListComponent(de.mossgrabers.framework.graphics.canvas.component.ClipListComponent) ListComponent(de.mossgrabers.framework.graphics.canvas.component.ListComponent) Pair(de.mossgrabers.framework.utils.Pair)

Aggregations

Pair (de.mossgrabers.framework.utils.Pair)3 ArrayList (java.util.ArrayList)3 ClipListComponent (de.mossgrabers.framework.graphics.canvas.component.ClipListComponent)2 ListComponent (de.mossgrabers.framework.graphics.canvas.component.ListComponent)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1