use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class AbstractConfiguration method registerDeactivatedItemsHandler.
/**
* Register a handler for the 'exclude deactivated items' setting.
*
* @param model The model for getting the banks to configure
*/
public void registerDeactivatedItemsHandler(final IModel model) {
this.addSettingObserver(AbstractConfiguration.EXCLUDE_DEACTIVATED_ITEMS, () -> {
final boolean exclude = this.areDeactivatedItemsExcluded();
final ITrackBank trackBank = model.getTrackBank();
trackBank.setSkipDisabledItems(exclude);
for (int i = 0; i < trackBank.getPageSize(); i++) trackBank.getItem(i).getSendBank().setSkipDisabledItems(exclude);
final ITrackBank effectTrackBank = model.getEffectTrackBank();
if (effectTrackBank != null)
effectTrackBank.setSkipDisabledItems(exclude);
final ICursorDevice cursorDevice = model.getCursorDevice();
final IDeviceBank deviceBank = cursorDevice.getDeviceBank();
deviceBank.setSkipDisabledItems(exclude);
cursorDevice.getLayerBank().setSkipDisabledItems(exclude);
final IDrumPadBank drumPadBank = cursorDevice.getDrumPadBank();
if (drumPadBank != null)
drumPadBank.setSkipDisabledItems(exclude);
});
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class MoveTrackBankCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(this.deviceMode)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (this.moveBy1) {
this.handleBankMovement(cursorDevice.getParameterBank());
return;
}
if (this.moveLeft)
cursorDevice.selectPrevious();
else
cursorDevice.selectNext();
return;
}
if (modeManager.isActive(Modes.MARKERS)) {
this.handleBankMovement(this.model.getMarkerBank());
return;
}
this.handleBankMovement(this.model.getCurrentTrackBank());
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsMode method moveUp.
/**
* Move up the hierarchy.
*/
protected void moveUp() {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.DEVICE_CHAINS)) {
modeManager.setActive(Modes.DEVICE_PARAMS);
return;
}
// There is no device on the track move upwards to the track view
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist()) {
this.surface.getButton(ButtonID.TRACK).trigger(ButtonEvent.DOWN);
return;
}
// Parameter banks are shown -> show devices
final DeviceParamsMode deviceParamsMode = (DeviceParamsMode) modeManager.get(Modes.DEVICE_PARAMS);
if (!deviceParamsMode.isShowDevices()) {
deviceParamsMode.setShowDevices(true);
return;
}
// Devices are shown, if nested show the layers otherwise move up to the tracks
if (cd.isNested()) {
cd.selectParent();
this.model.getHost().scheduleTask(() -> {
if (cd.hasLayers())
modeManager.setActive(this.surface.getConfiguration().getCurrentLayerMixMode());
else
modeManager.setActive(Modes.DEVICE_PARAMS);
deviceParamsMode.setShowDevices(false);
cd.selectChannel();
}, 300);
return;
}
// Move up to the track
if (this.model.isCursorDeviceOnMasterTrack())
this.surface.getButton(ButtonID.MASTERTRACK).trigger(ButtonEvent.DOWN);
else
this.surface.getButton(ButtonID.TRACK).trigger(ButtonEvent.DOWN);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event == ButtonEvent.DOWN)
return;
if (event == ButtonEvent.UP) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist())
return;
// Select parameter bank if parameter banks are visible
if (!this.showDevices) {
cd.getParameterPageBank().selectPage(index);
return;
}
// Duplicate device
if (this.surface.isPressed(ButtonID.DUPLICATE)) {
this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
cd.duplicate();
return;
}
// Delete device
if (this.surface.isPressed(ButtonID.DELETE)) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
cd.getDeviceBank().getItem(index).remove();
return;
}
// Select device
if (cd.getIndex() != index) {
cd.getDeviceBank().getItem(index).select();
return;
}
// No layers, show devices
final ModeManager modeManager = this.surface.getModeManager();
if (!cd.hasLayers()) {
((DeviceParamsMode) modeManager.get(Modes.DEVICE_PARAMS)).setShowDevices(false);
return;
}
// If there are layers, make sure one is selected
final Optional<?> layer = cd.getLayerBank().getSelectedItem();
if (layer.isEmpty())
cd.getLayerBank().getItem(0).select();
modeManager.setActive(this.surface.getConfiguration().getCurrentLayerMixMode());
return;
}
// LONG press - move upwards
this.surface.setTriggerConsumed(ButtonID.get(ButtonID.ROW1_1, index));
this.moveUp();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists1(display, cd))
return;
// Row 1 & 2
final IParameterBank parameterBank = cd.getParameterBank();
for (int i = 0; i < 8; i++) {
final IParameter param = parameterBank.getItem(i);
display.setCell(0, i, param.doesExist() ? StringUtils.fixASCII(param.getName()) : "").setCell(1, i, StringUtils.fixASCII(param.getDisplayedValue(8)));
}
// Row 3
display.setBlock(2, 0, "Selected Device:").setBlock(2, 1, cd.getName());
// Row 4
if (this.showDevices) {
final IDeviceBank deviceBank = cd.getDeviceBank();
for (int i = 0; i < 8; i++) {
final IDevice device = deviceBank.getItem(i);
final StringBuilder sb = new StringBuilder();
if (device.doesExist()) {
if (i == cd.getIndex())
sb.append(Push1Display.SELECT_ARROW);
sb.append(device.getName());
}
display.setCell(3, i, sb.toString());
}
return;
}
final IParameterPageBank bank = cd.getParameterPageBank();
final int selectedItemIndex = bank.getSelectedItemIndex();
for (int i = 0; i < bank.getPageSize(); i++) {
final String item = bank.getItem(i);
final String selectedStr = i == selectedItemIndex ? Push1Display.SELECT_ARROW : "";
display.setCell(3, i, item.isEmpty() ? "" : selectedStr + item);
}
}
Aggregations