use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.
the class DeviceBrowserMode method updateSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void updateSecondRow() {
for (int i = 0; i < 7; i++) {
final IBrowserColumn col = this.getFilterColumn(i);
this.surface.updateButton(102 + i, col != null && col.doesExist() ? AbstractMode.BUTTON_COLOR2_ON : AbstractMode.BUTTON_COLOR_OFF);
}
this.surface.updateButton(109, AbstractMode.BUTTON_COLOR2_ON);
}
use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.
the class BrowserMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IBrowser browser = this.model.getBrowser();
if (!browser.isActive())
return;
final String[] rows = new String[3];
final boolean[] sels = new boolean[] { false, false, false };
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
final int idx = this.getTouchedKnob();
if (idx < 0) {
final String selectedResult = browser.getSelectedResult();
rows[0] = browser.getSelectedContentType().toUpperCase(Locale.US);
rows[1] = "Selection: ";
rows[2] = selectedResult == null || selectedResult.isBlank() ? "None" : selectedResult;
} else if (idx == 8) {
final IBrowserColumnItem[] results = browser.getResultColumnItems();
if (results[0].doesExist()) {
for (int item = 0; item < 3; item++) {
rows[item] = item < results.length ? results[item].getName() : "";
sels[item] = item < results.length && results[item].isSelected();
}
} else {
rows[0] = "No";
rows[1] = "results ";
rows[2] = "available...";
}
} else {
final IBrowserColumn filterColumn = browser.getFilterColumn(idx);
if (filterColumn.doesExist() && filterColumn.doesCursorExist()) {
final IBrowserColumnItem[] item = filterColumn.getItems();
for (int itemIndex = 0; itemIndex < 3; itemIndex++) {
final int pos = itemIndex;
String text = StringUtils.optimizeName(item[pos].getName(), 10);
if (!text.isEmpty())
text = text + " (" + item[pos].getHitCount() + ")";
rows[itemIndex] = text;
sels[itemIndex] = item[pos].isSelected();
}
} else {
rows[0] = "";
rows[1] = "";
rows[2] = "";
}
}
display.addListElement(rows, sels);
display.send();
}
use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.
the class DeviceBrowserMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final IBrowser browser = this.model.getBrowser();
if (!browser.isActive())
return;
switch(this.selectionMode) {
case DeviceBrowserMode.SELECTION_OFF:
String selectedResult = browser.getSelectedResult();
selectedResult = selectedResult == null || selectedResult.isBlank() ? "Selection: None" : "Selection: " + selectedResult;
for (int i = 0; i < 7; i++) {
final Optional<IBrowserColumn> column = this.getFilterColumn(i);
final String headerTopName = i == 0 ? browser.getInfoText() : "";
final String headerBottomName = i == 0 ? selectedResult : "";
final String menuBottomName = getColumnName(column);
display.addOptionElement(headerTopName, column.isEmpty() ? "" : column.get().getName(), i == this.filterColumn, headerBottomName, menuBottomName, !menuBottomName.equals(" "), false);
}
final boolean supportsPreview = this.model.getHost().supports(Capability.HAS_BROWSER_PREVIEW);
final String bottomMenu = supportsPreview ? "Preview" : "";
final ColorEx menuBottomColor = browser.isPreviewEnabled() ? ColorEx.ORANGE : ColorEx.GRAY;
display.addOptionElement("", browser.getSelectedContentType(), this.filterColumn == -1, null, "", bottomMenu, false, supportsPreview ? menuBottomColor : null, false);
break;
case DeviceBrowserMode.SELECTION_PRESET:
final IBrowserColumnItem[] results = browser.getResultColumnItems();
if (!results[0].doesExist()) {
for (int i = 0; i < 8; i++) display.addOptionElement(i == 3 ? "No results available..." : "", "", false, "", "", false, false);
return;
}
for (int i = 0; i < 8; i++) {
final String[] items = new String[6];
final boolean[] selected = new boolean[6];
for (int item = 0; item < 6; item++) {
final int pos = i * 6 + item;
items[item] = pos < results.length ? results[pos].getName(14) : "";
selected[item] = pos < results.length && results[pos].isSelected();
}
display.addListElement(items, selected);
}
break;
case DeviceBrowserMode.SELECTION_FILTER:
final IBrowserColumnItem[] item = browser.getFilterColumn(this.filterColumn).getItems();
for (int i = 0; i < 8; i++) {
final String[] items = new String[6];
final boolean[] selected = new boolean[6];
for (int itemIndex = 0; itemIndex < 6; itemIndex++) {
final int pos = i * 6 + itemIndex;
final String hitText = " (" + item[pos].getHitCount() + ")";
String text = item[pos].getName(12 - hitText.length());
if (!text.isEmpty())
text = text + hitText;
items[itemIndex] = text;
selected[itemIndex] = item[pos].isSelected();
}
display.addListElement(items, selected);
}
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.daw.data.IBrowserColumn in project DrivenByMoss by git-moss.
the class DeviceBrowserMode method selectPrevious.
private void selectPrevious(final int index, final int count) {
final IBrowser browser = this.model.getBrowser();
if (index < 7) {
final Optional<IBrowserColumn> fc = this.getFilterColumn(index);
if (fc.isPresent() && fc.get().doesExist()) {
final int fi = fc.get().getIndex();
if (fi < 0)
return;
this.filterColumn = fi;
for (int j = 0; j < count; j++) browser.selectPreviousFilterItem(this.filterColumn);
}
} else {
for (int j = 0; j < count; j++) browser.selectPreviousResult();
}
}
use of de.mossgrabers.framework.daw.data.IBrowserColumn 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();
}
Aggregations