Search in sources :

Example 11 with IBrowserColumn

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

the class BrowserMode method selectNext.

private void selectNext(final int index, final int count) {
    final IBrowser browser = this.model.getBrowser();
    final int filterColumnCount = Math.min(browser.getFilterColumnCount(), 7);
    if (index < filterColumnCount) {
        final IBrowserColumn fc = browser.getFilterColumn(index);
        if (fc != null && fc.doesExist()) {
            final int fi = fc.getIndex();
            if (fi < 0)
                return;
            for (int i = 0; i < count; i++) browser.selectNextFilterItem(fi);
        }
    } else {
        for (int i = 0; i < count; i++) browser.selectNextResult();
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 12 with IBrowserColumn

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

the class BrowseMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay();
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    d.clear();
    String selectedResult;
    switch(this.selectionMode) {
        case BrowseMode.SELECTION_OFF:
            d.setCell(0, 0, "BROWSE").setCell(1, 0, browser.getSelectedContentType().toUpperCase(Locale.US));
            selectedResult = browser.getSelectedResult();
            d.setCell(0, 8, "SELECTED").setCell(1, 8, selectedResult == null ? "NONE" : selectedResult);
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = browser.getFilterColumn(i);
                d.setCell(0, 1 + i, StringUtils.shortenAndFixASCII(column.getName() + ":", 8).toUpperCase(Locale.US)).setCell(1, 1 + i, column.doesCursorExist() ? column.getCursorName().toUpperCase(Locale.US) : "");
            }
            break;
        case BrowseMode.SELECTION_PRESET:
            d.setCell(0, 0, "SELECTED");
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < 16; i++) d.setCell(i % 2, 1 + i / 2, (results[i].isSelected() ? ">" : " ") + results[i].getName().toUpperCase(Locale.US));
            break;
        case BrowseMode.SELECTION_FILTER:
            final IBrowserColumn fc = browser.getFilterColumn(this.filterColumn);
            d.setCell(0, 0, fc.getName().toUpperCase(Locale.US));
            final IBrowserColumnItem[] items = fc.getItems();
            for (int i = 0; i < 16; i++) {
                final String name = items[i].getName().toUpperCase(Locale.US);
                final String text = (items[i].isSelected() ? ">" : " ") + name;
                d.setCell(i % 2, 1 + i / 2, text);
            }
            break;
        default:
            // No more modes
            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) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay)

Example 13 with IBrowserColumn

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

the class BrowseMode method selectNext.

/**
 * Select the next filter or preset.
 *
 * @param count The number of items to increase
 */
public void selectNext(final int count) {
    final int index = this.selectedColumn == -1 ? 7 : this.selectedColumn;
    final IBrowser browser = this.model.getBrowser();
    if (index < 7) {
        final IBrowserColumn fc = browser.getFilterColumn(index);
        if (fc != null && fc.doesExist()) {
            this.filterColumn = fc.getIndex();
            for (int i = 0; i < count; i++) browser.selectNextFilterItem(this.filterColumn);
            if (browser.getSelectedFilterItemIndex(this.filterColumn) == -1)
                browser.nextFilterItemPage(this.filterColumn);
        }
    } else {
        for (int i = 0; i < count; i++) browser.selectNextResult();
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 14 with IBrowserColumn

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

the class BrowseMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    if (!isTouched)
        return;
    this.selectedColumn = this.selectedColumn != -1 ? -1 : index;
    if (this.selectedColumn == -1) {
        this.selectionMode = BrowseMode.SELECTION_OFF;
        return;
    }
    if (index == 7) {
        this.selectionMode = BrowseMode.SELECTION_PRESET;
        this.filterColumn = -1;
    } else {
        final IBrowser browser = this.model.getBrowser();
        final IBrowserColumn fc = browser.getFilterColumn(index);
        if (fc != null && fc.doesExist()) {
            this.selectionMode = BrowseMode.SELECTION_FILTER;
            this.filterColumn = fc.getIndex();
        }
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 15 with IBrowserColumn

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

the class BrowseMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IBrowser browser = this.model.getBrowser();
    final ITextDisplay d = this.surface.getTextDisplay();
    final boolean isPresetSession = browser.isPresetContentType();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isPresetSession && !(browser.isActive() && cd.doesExist())) {
        d.notify("No active Browsing Session. Select device and press Browser...");
        return;
    }
    d.clear();
    for (int i = 0; i < 7; i++) {
        final Optional<IBrowserColumn> column = this.getFilterColumn(i);
        String value = "";
        String name = "";
        if (column.isPresent()) {
            final IBrowserColumn browserColumn = column.get();
            if (browserColumn.doesCursorExist())
                value = browserColumn.getCursorName().equals(browserColumn.getWildcard()) ? "-" : browserColumn.getCursorName();
            name = StringUtils.shortenAndFixASCII(browserColumn.getName(), 6);
        }
        if (i == this.getSelectedParameter())
            name = ">" + name;
        d.setCell(0, i, name).setCell(1, i, value);
    }
    final String selectedResult = browser.getSelectedResult();
    String selectedContentType = browser.getSelectedContentType();
    if (this.getSelectedParameter() == 7)
        selectedContentType = ">" + selectedContentType;
    d.setCell(0, 7, selectedContentType).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

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