Search in sources :

Example 21 with IBrowser

use of de.mossgrabers.framework.daw.IBrowser 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 22 with IBrowser

use of de.mossgrabers.framework.daw.IBrowser 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 23 with IBrowser

use of de.mossgrabers.framework.daw.IBrowser 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 24 with IBrowser

use of de.mossgrabers.framework.daw.IBrowser 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 25 with IBrowser

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

the class DeviceBrowserMode method getFilterColumn.

private Optional<IBrowserColumn> getFilterColumn(final int index) {
    final IBrowser browser = this.model.getBrowser();
    int column = -1;
    final boolean[] browserDisplayFilter = this.surface.getConfiguration().getBrowserDisplayFilter();
    for (int i = 0; i < browser.getFilterColumnCount(); i++) {
        if (browserDisplayFilter[i]) {
            column++;
            if (column == index)
                return Optional.of(browser.getFilterColumn(i));
        }
    }
    return Optional.empty();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

Aggregations

IBrowser (de.mossgrabers.framework.daw.IBrowser)49 IBrowserColumn (de.mossgrabers.framework.daw.data.IBrowserColumn)21 IBrowserColumnItem (de.mossgrabers.framework.daw.data.IBrowserColumnItem)11 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)5 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 ViewManager (de.mossgrabers.framework.view.ViewManager)4 Display (de.mossgrabers.framework.controller.display.Display)3 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)3 ITrack (de.mossgrabers.framework.daw.data.ITrack)3 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)2 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)2 PushDisplay (de.mossgrabers.push.controller.PushDisplay)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 ParametersMode (de.mossgrabers.controller.novation.slmkiii.mode.device.ParametersMode)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)1 ILayer (de.mossgrabers.framework.daw.data.ILayer)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1