use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowserMode method selectNext.
private void selectNext(final int index, final int count) {
final IBrowser browser = this.model.getBrowser();
final int filterColumnCount = Math.min(browser.getFilterColumnCount(), 7);
if (index < filterColumnCount) {
final IBrowserColumn fc = browser.getFilterColumn(index);
if (fc != null && fc.doesExist()) {
final int fi = fc.getIndex();
if (fi < 0)
return;
for (int i = 0; i < count; i++) browser.selectNextFilterItem(fi);
}
} else {
for (int i = 0; i < count; i++) browser.selectNextResult();
}
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowseMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay();
final IBrowser browser = this.model.getBrowser();
if (!browser.isActive())
return;
d.clear();
String selectedResult;
switch(this.selectionMode) {
case BrowseMode.SELECTION_OFF:
d.setCell(0, 0, "BROWSE").setCell(1, 0, browser.getSelectedContentType().toUpperCase(Locale.US));
selectedResult = browser.getSelectedResult();
d.setCell(0, 8, "SELECTED").setCell(1, 8, selectedResult == null ? "NONE" : selectedResult);
for (int i = 0; i < 7; i++) {
final IBrowserColumn column = browser.getFilterColumn(i);
d.setCell(0, 1 + i, StringUtils.shortenAndFixASCII(column.getName() + ":", 8).toUpperCase(Locale.US)).setCell(1, 1 + i, column.doesCursorExist() ? column.getCursorName().toUpperCase(Locale.US) : "");
}
break;
case BrowseMode.SELECTION_PRESET:
d.setCell(0, 0, "SELECTED");
final IBrowserColumnItem[] results = browser.getResultColumnItems();
for (int i = 0; i < 16; i++) d.setCell(i % 2, 1 + i / 2, (results[i].isSelected() ? ">" : " ") + results[i].getName().toUpperCase(Locale.US));
break;
case BrowseMode.SELECTION_FILTER:
final IBrowserColumn fc = browser.getFilterColumn(this.filterColumn);
d.setCell(0, 0, fc.getName().toUpperCase(Locale.US));
final IBrowserColumnItem[] items = fc.getItems();
for (int i = 0; i < 16; i++) {
final String name = items[i].getName().toUpperCase(Locale.US);
final String text = (items[i].isSelected() ? ">" : " ") + name;
d.setCell(i % 2, 1 + i / 2, text);
}
break;
default:
// No more modes
break;
}
d.allDone();
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowseMode method selectNext.
/**
* Select the next filter or preset.
*
* @param count The number of items to increase
*/
public void selectNext(final int count) {
final int index = this.selectedColumn == -1 ? 7 : this.selectedColumn;
final IBrowser browser = this.model.getBrowser();
if (index < 7) {
final IBrowserColumn fc = browser.getFilterColumn(index);
if (fc != null && fc.doesExist()) {
this.filterColumn = fc.getIndex();
for (int i = 0; i < count; i++) browser.selectNextFilterItem(this.filterColumn);
if (browser.getSelectedFilterItemIndex(this.filterColumn) == -1)
browser.nextFilterItemPage(this.filterColumn);
}
} else {
for (int i = 0; i < count; i++) browser.selectNextResult();
}
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowseMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
if (!isTouched)
return;
this.selectedColumn = this.selectedColumn != -1 ? -1 : index;
if (this.selectedColumn == -1) {
this.selectionMode = BrowseMode.SELECTION_OFF;
return;
}
if (index == 7) {
this.selectionMode = BrowseMode.SELECTION_PRESET;
this.filterColumn = -1;
} else {
final IBrowser browser = this.model.getBrowser();
final IBrowserColumn fc = browser.getFilterColumn(index);
if (fc != null && fc.doesExist()) {
this.selectionMode = BrowseMode.SELECTION_FILTER;
this.filterColumn = fc.getIndex();
}
}
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class DeviceBrowserMode 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();
}
Aggregations