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();
}
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);
}
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);
}
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);
}
}
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();
}
Aggregations