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