Search in sources :

Example 16 with IBrowserColumn

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

the class BrowserImpl method enableObservers.

/**
 * {@inheritDoc}
 */
@Override
public void enableObservers(final boolean enable) {
    this.browser.exists().setIsSubscribed(enable);
    this.browser.selectedContentTypeIndex().setIsSubscribed(enable);
    this.browser.selectedContentTypeName().setIsSubscribed(enable);
    this.browser.contentTypeNames().setIsSubscribed(enable);
    for (final IBrowserColumn column : this.columnData) column.enableObservers(enable);
    this.cursorResult.name().setIsSubscribed(enable);
    for (final IBrowserColumnItem item : this.resultData) item.enableObservers(enable);
}
Also used : IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 17 with IBrowserColumn

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

the class OSCWriter method flushBrowser.

private void flushBrowser(final String browserAddress, final IBrowser browser, final boolean dump) {
    this.sendOSC(browserAddress + "isActive", browser.isActive(), dump);
    this.sendOSC(browserAddress + "tab", browser.getSelectedContentType(), dump);
    IBrowserColumn column;
    // Filter Columns
    for (int i = 0; i < browser.getFilterColumnCount(); i++) {
        final String filterAddress = browserAddress + "filter/" + (i + 1) + "/";
        column = browser.getFilterColumn(i);
        this.sendOSC(filterAddress + "exists", column.doesExist(), dump);
        this.sendOSC(filterAddress + "name", column.getName(), dump);
        this.sendOSC(filterAddress + "wildcard", column.getWildcard(), dump);
        final IBrowserColumnItem[] items = column.getItems();
        for (int j = 0; j < items.length; j++) {
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/exists", items[j].doesExist(), dump);
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/name", items[j].getName(), dump);
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/hits", items[j].getHitCount(), dump);
            this.sendOSC(filterAddress + "item/" + (j + 1) + "/isSelected", items[j].isSelected(), dump);
        }
    }
    // Presets
    final String presetAddress = browserAddress + "result/";
    final IBrowserColumnItem[] items = browser.getResultColumnItems();
    for (int i = 0; i < items.length; i++) {
        this.sendOSC(presetAddress + (i + 1) + "/exists", items[i].doesExist(), dump);
        this.sendOSC(presetAddress + (i + 1) + "/name", items[i].getName(), dump);
        this.sendOSC(presetAddress + (i + 1) + "/hits", items[i].getHitCount(), dump);
        this.sendOSC(presetAddress + (i + 1) + "/isSelected", items[i].isSelected(), dump);
    }
}
Also used : IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 18 with IBrowserColumn

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

the class DeviceBrowserMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IBrowser browser = this.model.getBrowser();
    final Display d = this.surface.getDisplay();
    final boolean isPresetSession = browser.isPresetContentType();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isPresetSession && !(browser.isActive() && cd.hasSelectedDevice())) {
        d.notify("No active Browsing Session. Select device and press Browser...");
        return;
    }
    d.clear();
    switch(this.selectionMode) {
        case SELECTION_OFF:
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = this.getFilterColumn(i);
                final String value = column != null && column.doesCursorExist() ? column.getCursorName().equals(column.getWildcard()) ? "-" : column.getCursorName() : "";
                final String name = column == null ? "" : StringUtils.shortenAndFixASCII(column.getName(), 6);
                d.setCell(0, i, name).setCell(1, i, value);
            }
            final String selectedResult = browser.getSelectedResult();
            d.setCell(0, 7, browser.getSelectedContentType()).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
            break;
        case SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < browser.getNumFilterColumnEntries(); i++) {
                if (i < results.length)
                    d.setBlock(i / 4, i % 4, (results[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(results[i].getName()));
                else
                    break;
            }
            break;
        case SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < browser.getNumResults(); i++) d.setBlock(i / 4, i % 4, (items[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(items[i].getName()));
            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) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) Display(de.mossgrabers.framework.controller.display.Display)

Example 19 with IBrowserColumn

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

the class DeviceBrowserMode method resetParameter.

/**
 * {@inheritDoc}
 */
@Override
protected void resetParameter(final int index) {
    if (this.selectionMode != SELECTION_OFF) {
        this.selectionMode = SELECTION_OFF;
        return;
    }
    if (index == 7) {
        this.selectionMode = SELECTION_PRESET;
        this.filterColumn = -1;
    } else {
        final IBrowserColumn fc = this.getFilterColumn(index);
        if (fc != null && fc.doesExist()) {
            this.selectionMode = SELECTION_FILTER;
            this.filterColumn = fc.getIndex();
        }
    }
}
Also used : IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Example 20 with IBrowserColumn

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

the class DeviceBrowserMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1() {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive()) {
        this.surface.getModeManager().restoreMode();
        return;
    }
    final Display d = this.surface.getDisplay().clear();
    switch(this.selectionMode) {
        case DeviceBrowserMode.SELECTION_OFF:
            final String selectedResult = browser.getSelectedResult();
            final String deviceName = this.model.getCursorDevice().getName();
            String selectedContentType = browser.getSelectedContentType();
            if (this.filterColumn == -1)
                selectedContentType = PushDisplay.RIGHT_ARROW + selectedContentType;
            d.setCell(0, 7, selectedContentType).setBlock(3, 0, " Selected Device:").setBlock(3, 1, deviceName.length() == 0 ? "None" : deviceName);
            final boolean isPresetSession = browser.isPresetContentType();
            d.setBlock(3, 2, isPresetSession ? " Selected Preset:" : "").setBlock(3, 3, isPresetSession ? selectedResult == null || selectedResult.length() == 0 ? "None" : selectedResult : "");
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = this.getFilterColumn(i);
                String name = column == null ? "" : StringUtils.shortenAndFixASCII(column.getName(), 8);
                if (i == this.filterColumn)
                    name = PushDisplay.RIGHT_ARROW + name;
                d.setCell(0, i, name).setCell(1, i, getColumnName(column));
            }
            break;
        case DeviceBrowserMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            if (!results[0].doesExist()) {
                d.clear().setBlock(1, 1, "       No results").setBlock(1, 2, "available...").allDone();
                return;
            }
            for (int i = 0; i < 16; i++) {
                if (i < results.length)
                    d.setBlock(i % 4, i / 4, (results[i].isSelected() ? PushDisplay.RIGHT_ARROW : " ") + results[i].getName(16));
                else
                    d.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() ? PushDisplay.RIGHT_ARROW : " ") + items[i].getName() + "                ";
                if (!items[i].getName().isEmpty()) {
                    final String hitStr = "(" + items[i].getHitCount() + ")";
                    text = text.substring(0, 17 - hitStr.length()) + hitStr;
                }
                d.setBlock(i % 4, i / 4, 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) PushDisplay(de.mossgrabers.push.controller.PushDisplay)

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