Search in sources :

Example 26 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 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)

Example 27 with IBrowser

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

the class BrowseMode 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)

Example 28 with IBrowser

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

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

the class DeviceBrowserMode method getFilterColumn.

private 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 browser.getFilterColumn(i);
        }
    }
    return null;
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

Example 30 with IBrowser

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

the class PushCursorCommand method updateArrowStates.

/**
 * {@inheritDoc}
 */
@Override
protected void updateArrowStates() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    this.canScrollUp = tb.canScrollScenesUp();
    this.canScrollDown = tb.canScrollScenesDown();
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
        final DeviceParamsMode mode = (DeviceParamsMode) modeManager.getActiveMode();
        this.canScrollLeft = mode.canSelectPreviousPage();
        this.canScrollRight = mode.canSelectNextPage();
        return;
    }
    if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
        final IBrowser browser = this.model.getBrowser();
        final int index = browser.getSelectedContentTypeIndex();
        this.canScrollLeft = index > 0;
        this.canScrollRight = index < browser.getContentTypeNames().length - 1;
        return;
    }
    if (Modes.isLayerMode(modeManager.getActiveModeId())) {
        final ICursorDevice cd = this.model.getCursorDevice();
        this.canScrollLeft = cd.canScrollLayersOrDrumPadsUp();
        this.canScrollRight = cd.canScrollLayersOrDrumPadsDown();
        return;
    }
    final ITrack sel = tb.getSelectedTrack();
    final int selIndex = sel != null ? sel.getIndex() : -1;
    this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
    this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) DeviceParamsMode(de.mossgrabers.push.mode.device.DeviceParamsMode) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

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