use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class AddDeviceCommand 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.isActive()) {
final IBrowserColumn collectionsColumn = browser.getFilterColumn(0);
final IBrowserColumnItem first = collectionsColumn.getItems()[0];
if (first.getName().equals(collectionsColumn.getWildcard()) && first.isSelected())
collectionsColumn.selectNextItem();
else
collectionsColumn.resetFilter();
} else
super.executeNormal(event);
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowserModule method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final String command, final LinkedList<String> path, final Object value) throws IllegalParameterException, UnknownCommandException, MissingCommandException {
if (!"browser".equals(command))
throw new UnknownCommandException(command);
final String subCommand = getSubCommand(path);
final IBrowser browser = this.model.getBrowser();
switch(subCommand) {
case "preset":
browser.replace(this.model.getCursorDevice());
break;
case "tab":
if (!browser.isActive())
return;
final String subCmd = getSubCommand(path);
if ("+".equals(subCmd))
browser.nextContentType();
else if ("-".equals(subCmd))
browser.previousContentType();
break;
case "device":
final String insertLocation = path.isEmpty() ? null : path.removeFirst();
if (insertLocation == null || "after".equals(insertLocation))
browser.insertAfterCursorDevice();
else
browser.insertBeforeCursorDevice();
break;
case "commit":
browser.stopBrowsing(true);
break;
case "cancel":
browser.stopBrowsing(false);
break;
case "filter":
final String indexCmd = getSubCommand(path);
int column = Integer.parseInt(indexCmd);
if (column < 1 || column > 6)
return;
column = column - 1;
if (!browser.isActive())
return;
final String cmd = getSubCommand(path);
if ("+".equals(cmd))
browser.selectNextFilterItem(column);
else if ("-".equals(cmd))
browser.selectPreviousFilterItem(column);
else if ("reset".equals(cmd))
browser.getFilterColumn(column).resetFilter();
break;
case "result":
if (!browser.isActive())
return;
final String direction = path.isEmpty() ? "+" : path.removeFirst();
if ("+".equals(direction))
browser.selectNextResult();
else
browser.selectPreviousResult();
break;
default:
throw new UnknownCommandException(command);
}
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowserMode method onKnobValue.
/**
* {@inheritDoc}
*/
@Override
public void onKnobValue(final int index, final int value) {
final boolean isInc = this.model.getValueChanger().isIncrease(value);
final IBrowser browser = this.model.getBrowser();
if (browser == null)
return;
switch(index) {
case 0:
case 1:
if (isInc)
browser.nextContentType();
else
browser.previousContentType();
break;
case 2:
case 3:
if (isInc)
browser.selectNextFilterColumn();
else
browser.selectPreviousFilterColumn();
break;
case 4:
case 5:
if (isInc)
browser.getSelectedFilterColumn().selectNextItem();
else
browser.getSelectedFilterColumn().selectPreviousItem();
break;
case 6:
case 7:
if (isInc)
browser.selectNextResult();
else
browser.selectPreviousResult();
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.daw.IBrowser 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 SLMkIIIDisplay d = this.surface.getDisplay();
d.clear();
d.setCell(0, 0, StringUtils.fixASCII(browser.getSelectedContentType()));
d.setPropertyColor(0, 0, SLMkIIIColorManager.SLMKIII_GREEN);
d.setCell(3, 0, "<< Tab");
d.setPropertyColor(0, 2, SLMkIIIColorManager.SLMKIII_GREEN);
d.setPropertyValue(0, 1, 0);
d.setPropertyColor(1, 0, SLMkIIIColorManager.SLMKIII_GREEN);
d.setCell(3, 1, "Tab >>");
d.setPropertyColor(1, 2, SLMkIIIColorManager.SLMKIII_GREEN);
d.setPropertyValue(1, 1, 0);
final IBrowserColumn selectedFilterColumn = browser.getSelectedFilterColumn();
d.setCell(0, 2, selectedFilterColumn.doesExist() ? StringUtils.fixASCII(selectedFilterColumn.getName()) : "-");
d.setPropertyColor(2, 0, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
d.setCell(3, 2, "<< Filter");
d.setPropertyColor(2, 2, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
d.setPropertyValue(2, 1, 0);
d.setPropertyColor(3, 0, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
d.setCell(3, 3, "Filter >>");
d.setPropertyColor(3, 2, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
d.setPropertyValue(3, 1, 0);
d.setCell(0, 4, selectedFilterColumn.doesExist() ? StringUtils.fixASCII(selectedFilterColumn.getCursorName()) : "-");
d.setPropertyColor(4, 0, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
d.setCell(3, 4, "<< F-Sel");
d.setPropertyColor(4, 2, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
d.setPropertyValue(4, 1, 0);
d.setPropertyColor(5, 0, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
d.setCell(3, 5, "F-Sel >>");
d.setPropertyColor(5, 2, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
d.setPropertyValue(5, 1, 0);
final String resultName = StringUtils.pad(StringUtils.fixASCII(browser.getSelectedResult()), 18, ' ');
final String name1 = resultName.substring(0, 9);
final String name2 = resultName.substring(9, 18);
d.setCell(0, 6, name1);
d.setPropertyColor(6, 0, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
d.setCell(3, 6, "<< Result");
d.setPropertyColor(6, 2, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
d.setPropertyValue(6, 1, 0);
d.setCell(0, 7, name2);
d.setPropertyColor(7, 0, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
d.setCell(3, 7, "Result >>");
d.setPropertyColor(7, 2, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
d.setPropertyValue(7, 1, 0);
d.setCell(0, 8, "Browser");
this.setButtonInfo(d);
d.allDone();
}
use of de.mossgrabers.framework.daw.IBrowser in project DrivenByMoss by git-moss.
the class BrowserView method onKnob.
/**
* {@inheritDoc}
*/
@Override
public void onKnob(final int index, final int value, final boolean isTurnedRight) {
final IBrowser browser = this.model.getBrowser();
if (!browser.isActive())
return;
final int steps = Math.abs(this.model.getValueChanger().calcSteppedKnobChange(value));
int column;
switch(index) {
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
column = index - 8;
if (isTurnedRight) {
for (int i = 0; i < steps; i++) browser.selectNextFilterItem(column);
} else {
for (int i = 0; i < steps; i++) browser.selectPreviousFilterItem(column);
}
break;
case 15:
if (isTurnedRight) {
for (int i = 0; i < steps; i++) browser.selectNextResult();
} else {
for (int i = 0; i < steps; i++) browser.selectPreviousResult();
}
break;
default:
// Not used
break;
}
}
Aggregations