Search in sources :

Example 41 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 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();
    switch(this.selectionMode) {
        case SELECTION_OFF:
            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);
                }
                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;
        default:
            // Not used
            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) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 42 with IBrowser

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

the class DeviceModeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.UP)
        return;
    final IBrowser browser = this.model.getBrowser();
    if (browser != null && browser.isActive())
        browser.stopBrowsing(!this.surface.isShiftPressed());
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(Modes.DEVICE_PARAMS)) {
        final ParametersMode parametersMode = (ParametersMode) modeManager.get(Modes.DEVICE_PARAMS);
        parametersMode.setShowDevices(!parametersMode.isShowDevices());
        return;
    }
    this.deviceModeSelectCommand.execute(ButtonEvent.DOWN, 127);
}
Also used : ParametersMode(de.mossgrabers.controller.novation.slmkiii.mode.device.ParametersMode) IBrowser(de.mossgrabers.framework.daw.IBrowser) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 43 with IBrowser

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

the class TrackModeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.UP)
        return;
    final IBrowser browser = this.model.getBrowser();
    if (browser != null && browser.isActive())
        browser.stopBrowsing(!this.surface.isShiftPressed());
    this.modeSelectCommand.execute(ButtonEvent.UP, 127);
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

Example 44 with IBrowser

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

the class BrowserModule method flush.

/**
 * {@inheritDoc}
 */
@Override
public void flush(final boolean dump) {
    final String browserAddress = "/browser/";
    final IBrowser browser = this.model.getBrowser();
    final boolean isActive = browser.isActive();
    this.writer.sendOSC(browserAddress + "isActive", isActive, dump);
    if (!isActive)
        return;
    this.writer.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.writer.sendOSC(filterAddress + TAG_EXISTS, column.doesExist(), dump);
        this.writer.sendOSC(filterAddress + TAG_NAME, column.getName(), dump);
        this.writer.sendOSC(filterAddress + "wildcard", column.getWildcard(), dump);
        final IBrowserColumnItem[] items = column.getItems();
        for (int j = 0; j < items.length; j++) {
            final String browserItemAddress = filterAddress + "item/" + (j + 1) + "/";
            this.writer.sendOSC(browserItemAddress + TAG_EXISTS, items[j].doesExist(), dump);
            this.writer.sendOSC(browserItemAddress + TAG_NAME, items[j].getName(), dump);
            this.writer.sendOSC(browserItemAddress + "hits", items[j].getHitCount(), dump);
            this.writer.sendOSC(browserItemAddress + "isSelected", items[j].isSelected(), dump);
        }
    }
    // Presets
    final String presetAddress = browserAddress + "result/";
    final IBrowserColumnItem[] items = browser.getResultColumnItems();
    for (int i = 0; i < items.length; i++) {
        final String browserPresetAddress = presetAddress + (i + 1) + "/";
        this.writer.sendOSC(browserPresetAddress + TAG_EXISTS, items[i].doesExist(), dump);
        this.writer.sendOSC(browserPresetAddress + TAG_NAME, items[i].getName(), dump);
        this.writer.sendOSC(browserPresetAddress + "hits", items[i].getHitCount(), dump);
        this.writer.sendOSC(browserPresetAddress + "isSelected", items[i].isSelected(), dump);
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

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

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