use of de.mossgrabers.framework.daw.data.IBrowserColumn 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.data.IBrowserColumn 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.data.IBrowserColumn 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.data.IBrowserColumn 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.data.IBrowserColumn 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();
}
Aggregations