Search in sources :

Example 6 with IBrowser

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

the class DevicePresetsMode method navigatePresets.

/**
 * Navigate to the next or previous result item.
 *
 * @param moveUp True to move up
 */
public void navigatePresets(final boolean moveUp) {
    this.selectionMode = DevicePresetsMode.SELECTION_PRESET;
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    if (moveUp)
        browser.selectNextResult();
    else
        browser.selectPreviousResult();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

Example 7 with IBrowser

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

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

the class DeviceBrowserMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1(final ITextDisplay display) {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    switch(this.selectionMode) {
        case DeviceBrowserMode.SELECTION_OFF:
            String selectedContentType = browser.getSelectedContentType();
            if (this.filterColumn == -1)
                selectedContentType = Push1Display.SELECT_ARROW + selectedContentType;
            display.setCell(0, 7, selectedContentType);
            display.setBlock(2, 2, "Selection:");
            String selectedResult = browser.getSelectedResult();
            selectedResult = selectedResult == null || selectedResult.isBlank() ? "None" : selectedResult;
            String[] infoText = browser.getInfoText().split(":");
            infoText = new String[] { infoText[0] + ":", infoText.length == 1 ? "" : infoText[1].trim() };
            String info1 = infoText[0].length() > 17 ? infoText[0].substring(0, 17) : infoText[0];
            String info2 = infoText[0].length() > 17 ? infoText[0].substring(17, infoText[0].length()) : "";
            display.setBlock(2, 0, info1).setBlock(2, 1, info2);
            info1 = infoText[1].length() > 17 ? infoText[1].substring(0, 17) : infoText[1];
            info2 = infoText[1].length() > 17 ? infoText[1].substring(17, infoText[1].length()) : "";
            display.setBlock(3, 0, info1).setBlock(3, 1, info2);
            final String sel1 = selectedResult.length() > 17 ? selectedResult.substring(0, 17) : selectedResult;
            final String sel2 = selectedResult.length() > 17 ? selectedResult.substring(17, selectedResult.length()) : "";
            display.setBlock(3, 2, sel1).setCell(3, 6, sel2);
            if (this.model.getHost().supports(Capability.HAS_BROWSER_PREVIEW)) {
                display.setCell(2, 7, "Preview:");
                display.setCell(3, 7, browser.isPreviewEnabled() ? "On" : "Off");
            }
            for (int i = 0; i < 7; i++) {
                final Optional<IBrowserColumn> column = this.getFilterColumn(i);
                String name = column.isEmpty() ? "" : StringUtils.shortenAndFixASCII(column.get().getName(), 8);
                if (i == this.filterColumn)
                    name = Push1Display.SELECT_ARROW + name;
                display.setCell(0, i, name).setCell(1, i, getColumnName(column));
            }
            break;
        case DeviceBrowserMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            if (!results[0].doesExist()) {
                display.clear().setBlock(1, 1, "       No results").setBlock(1, 2, "available...").allDone();
                return;
            }
            for (int i = 0; i < 16; i++) {
                if (i < results.length)
                    display.setBlock(i % 4, i / 4, (results[i].isSelected() ? Push1Display.SELECT_ARROW : " ") + results[i].getName(16));
                else
                    display.setBlock(i % 4, i / 4, "");
            }
            break;
        case DeviceBrowserMode.SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < 16; i++) {
                String text = (items[i].isSelected() ? Push1Display.SELECT_ARROW : " ") + items[i].getName() + "                ";
                if (!items[i].getName().isEmpty()) {
                    final String hitStr = "(" + items[i].getHitCount() + ")";
                    text = text.substring(0, 17 - hitStr.length()) + hitStr;
                }
                display.setBlock(i % 4, i / 4, text);
            }
            break;
        default:
            // Not used
            break;
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 9 with IBrowser

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

the class DeviceBrowserMode method selectNext.

private void selectNext(final int index, final int count) {
    final IBrowser browser = this.model.getBrowser();
    if (index < 7) {
        final Optional<IBrowserColumn> fc = this.getFilterColumn(index);
        if (fc.isPresent() && fc.get().doesExist()) {
            final int fi = fc.get().getIndex();
            if (fi < 0)
                return;
            this.filterColumn = fi;
            for (int i = 0; i < count; i++) browser.selectNextFilterItem(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 10 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