Search in sources :

Example 1 with IBrowserColumn

use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.

the class DeviceBrowserMode method updateFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateFirstRow() {
    for (int i = 0; i < 7; i++) {
        final IBrowserColumn col = this.getFilterColumn(i);
        this.surface.updateButton(20 + i, col != null && col.doesExist() ? AbstractMode.BUTTON_COLOR_ON : AbstractMode.BUTTON_COLOR_OFF);
    }
    this.surface.updateButton(27, AbstractMode.BUTTON_COLOR_ON);
}
Also used : IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 2 with IBrowserColumn

use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.

the class DeviceBrowserMode method onValueKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
    // Make sure that only 1 knob gets changed in browse mode to prevent weird behaviour
    for (int i = 0; i < this.isKnobTouched.length; i++) if (this.isKnobTouched[i] && i != index)
        return;
    this.isKnobTouched[index] = isTouched;
    IBrowserColumn fc;
    if (isTouched) {
        if (this.surface.isDeletePressed()) {
            this.surface.setButtonConsumed(this.surface.getDeleteButtonId());
            fc = this.getFilterColumn(index);
            if (fc != null && fc.doesExist())
                this.model.getBrowser().resetFilterColumn(fc.getIndex());
            return;
        }
    } else {
        this.selectionMode = DeviceBrowserMode.SELECTION_OFF;
        return;
    }
    if (index == 7) {
        this.selectionMode = DeviceBrowserMode.SELECTION_PRESET;
        this.filterColumn = -1;
    } else {
        fc = this.getFilterColumn(index);
        if (fc != null && fc.doesExist()) {
            this.selectionMode = DeviceBrowserMode.SELECTION_FILTER;
            this.filterColumn = fc.getIndex();
        }
    }
}
Also used : IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 3 with IBrowserColumn

use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.

the class DeviceBrowserMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive()) {
        this.surface.getModeManager().restoreMode();
        return;
    }
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    switch(this.selectionMode) {
        case DeviceBrowserMode.SELECTION_OFF:
            String selectedResult = browser.getSelectedResult();
            if (selectedResult == null || selectedResult.length() == 0)
                selectedResult = "None";
            final boolean isPresetSession = browser.isPresetContentType();
            final String deviceName = this.model.getCursorDevice().getName();
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = this.getFilterColumn(i);
                final String headerTopName = i == 0 ? "Device: " + (deviceName.isEmpty() ? "None" : deviceName) : "";
                final String headerBottomName = i == 0 && isPresetSession ? "Preset: " + selectedResult : "";
                final String menuBottomName = getColumnName(column);
                message.addOptionElement(headerTopName, column == null ? "" : column.getName(), i == this.filterColumn, headerBottomName, menuBottomName, !menuBottomName.equals(" "), false);
            }
            message.addOptionElement("", browser.getSelectedContentType(), this.filterColumn == -1, "", "", false, false);
            break;
        case DeviceBrowserMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            if (!results[0].doesExist()) {
                for (int i = 0; i < 8; i++) message.addOptionElement(i == 3 ? "No results available..." : "", "", false, "", "", false, false);
                display.send(message);
                return;
            }
            for (int i = 0; i < 8; i++) {
                final String[] items = new String[6];
                final boolean[] selected = new boolean[6];
                for (int item = 0; item < 6; item++) {
                    final int pos = i * 6 + item;
                    items[item] = pos < results.length ? results[pos].getName(16) : "";
                    selected[item] = pos < results.length ? results[pos].isSelected() : false;
                }
                message.addListElement(items, selected);
            }
            break;
        case DeviceBrowserMode.SELECTION_FILTER:
            final IBrowserColumnItem[] item = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < 8; i++) {
                final String[] items = new String[6];
                final boolean[] selected = new boolean[6];
                for (int itemIndex = 0; itemIndex < 6; itemIndex++) {
                    final int pos = i * 6 + itemIndex;
                    String text = StringUtils.optimizeName(item[pos].getName(), 10);
                    if (!text.isEmpty())
                        text = text + " (" + item[pos].getHitCount() + ")";
                    items[itemIndex] = text;
                    selected[itemIndex] = item[pos].isSelected();
                }
                message.addListElement(items, selected);
            }
            break;
    }
    display.send(message);
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) PushDisplay(de.mossgrabers.push.controller.PushDisplay) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 4 with IBrowserColumn

use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.

the class DevicePresetsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final Display d = this.surface.getDisplay();
    if (!this.model.hasSelectedDevice()) {
        d.clearRow(2).done(2).setRow(0, "                       Please select a device...                       ");
        return;
    }
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive()) {
        d.setRow(0, "                     No active Browsing Session.                       ").setRow(2, "                        Press Browse again...                          ");
        return;
    }
    d.clear();
    String selectedResult;
    switch(this.selectionMode) {
        case DevicePresetsMode.SELECTION_OFF:
            selectedResult = browser.getSelectedResult();
            d.setBlock(0, 0, "Preset:").setBlock(2, 0, selectedResult == null ? "None" : selectedResult);
            for (int i = 0; i < 6; i++) {
                final IBrowserColumn column = browser.getFilterColumn(i);
                d.setCell(0, 2 + i, StringUtils.shortenAndFixASCII(column.getName() + ":", 8)).setCell(2, 2 + i, column.doesCursorExist() ? column.getCursorName() : "");
            }
            break;
        case DevicePresetsMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < 16; i++) d.setCell(i % 2 * 2, i / 2, (results[i].isSelected() ? SLDisplay.RIGHT_ARROW : " ") + results[i].getName());
            break;
        case DevicePresetsMode.SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < 16; i++) {
                final String name = StringUtils.fixASCII(items[i].getName());
                String text = (items[i].isSelected() ? SLDisplay.RIGHT_ARROW : " ") + name + "                ";
                if (!name.isEmpty()) {
                    final String hitStr = "(" + items[i].getHitCount() + ")";
                    text = text.substring(0, 17 - hitStr.length()) + hitStr;
                }
                d.setCell(i % 2 * 2, i / 2, text);
            }
            break;
    }
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) Display(de.mossgrabers.framework.controller.display.Display) SLDisplay(de.mossgrabers.sl.controller.SLDisplay)

Example 5 with IBrowserColumn

use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.

the class DevicePresetsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    if (!this.model.hasSelectedDevice()) {
        d.setRow(0, "                       Please select a device...                       ");
        d.done(0).done(1);
        return;
    }
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive()) {
        d.setRow(0, "                     No active Browsing Session.                       ");
        d.setRow(1, "                        Press Browse again...                          ");
        d.done(0).done(1);
        return;
    }
    String selectedResult;
    switch(this.selectionMode) {
        case DevicePresetsMode.SELECTION_OFF:
            selectedResult = browser.getSelectedResult();
            d.setBlock(0, 0, "Preset:").setBlock(1, 0, selectedResult == null ? "None" : selectedResult);
            for (int i = 0; i < 6; i++) {
                final IBrowserColumn column = browser.getFilterColumn(i);
                final String columnName = column.doesExist() ? StringUtils.shortenAndFixASCII(column.getName() + ":", 8) : "";
                d.setCell(0, 2 + i, columnName).setCell(1, 2 + i, column.doesCursorExist() ? column.getCursorName() : "");
            }
            break;
        case DevicePresetsMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < 16; i++) d.setCell(i % 2, i / 2, (results[i].isSelected() ? SLDisplay.RIGHT_ARROW : " ") + results[i].getName());
            break;
        case DevicePresetsMode.SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < 16; i++) {
                final String name = StringUtils.fixASCII(items[i].getName());
                String text = (items[i].isSelected() ? SLDisplay.RIGHT_ARROW : " ") + name + "                ";
                if (!name.isEmpty()) {
                    final String hitStr = "(" + items[i].getHitCount() + ")";
                    text = text.substring(0, 17 - hitStr.length()) + hitStr;
                }
                d.setCell(i % 2, i / 2, text);
            }
            break;
        default:
            // Not used
            break;
    }
    d.done(0).done(1);
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay)

Aggregations

IBrowserColumn (de.mossgrabers.framework.daw.data.IBrowserColumn)27 IBrowser (de.mossgrabers.framework.daw.IBrowser)21 IBrowserColumnItem (de.mossgrabers.framework.daw.data.IBrowserColumnItem)13 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 Display (de.mossgrabers.framework.controller.display.Display)3 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)2 PushDisplay (de.mossgrabers.push.controller.PushDisplay)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)1 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)1 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)1 SLDisplay (de.mossgrabers.sl.controller.SLDisplay)1