use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class MCUControllerSetup method createModel.
/**
* {@inheritDoc}
*/
@Override
protected void createModel() {
this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8 * this.numMCUDevices, 8, 8, 8, 8, true, 8 * this.numMCUDevices, -1, -1, -1);
final ITrackBank trackBank = this.model.getTrackBank();
trackBank.setIndication(true);
trackBank.addTrackSelectionObserver(this::handleTrackChange);
this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
final ModeManager modeManager = this.getSurface().getModeManager();
if (isSelected)
modeManager.setActiveMode(Modes.MODE_MASTER);
else
modeManager.restoreMode();
});
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class PushCursorCommand method scrollLeft.
/**
* {@inheritDoc}
*/
@Override
protected void scrollLeft() {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
final DeviceParamsMode paramsMode = (DeviceParamsMode) modeManager.getActiveMode();
if (this.surface.isShiftPressed())
paramsMode.selectPreviousPageBank();
else
paramsMode.selectPreviousPage();
return;
}
if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
((DeviceBrowserMode) modeManager.getActiveMode()).resetFilterColumn();
this.model.getBrowser().previousContentType();
return;
}
if (Modes.isLayerMode(modeManager.getActiveModeId())) {
if (this.surface.isShiftPressed())
this.model.getCursorDevice().previousLayerOrDrumPadBank();
else
this.model.getCursorDevice().previousLayerOrDrumPad();
return;
}
this.scrollTracksLeft();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class PushCursorCommand method updateArrowStates.
/**
* {@inheritDoc}
*/
@Override
protected void updateArrowStates() {
final IChannelBank tb = this.model.getCurrentTrackBank();
this.canScrollUp = tb.canScrollScenesUp();
this.canScrollDown = tb.canScrollScenesDown();
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
final DeviceParamsMode mode = (DeviceParamsMode) modeManager.getActiveMode();
this.canScrollLeft = mode.canSelectPreviousPage();
this.canScrollRight = mode.canSelectNextPage();
return;
}
if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
final IBrowser browser = this.model.getBrowser();
final int index = browser.getSelectedContentTypeIndex();
this.canScrollLeft = index > 0;
this.canScrollRight = index < browser.getContentTypeNames().length - 1;
return;
}
if (Modes.isLayerMode(modeManager.getActiveModeId())) {
final ICursorDevice cd = this.model.getCursorDevice();
this.canScrollLeft = cd.canScrollLayersOrDrumPadsUp();
this.canScrollRight = cd.canScrollLayersOrDrumPadsDown();
return;
}
final ITrack sel = tb.getSelectedTrack();
final int selIndex = sel != null ? sel.getIndex() : -1;
this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class PushQuantizeCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final ModeManager modeManager = this.surface.getModeManager();
if (event == ButtonEvent.LONG || event == ButtonEvent.DOWN && this.surface.isShiftPressed()) {
modeManager.setActiveMode(Modes.MODE_GROOVE);
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_QUANTIZE);
return;
}
if (event != ButtonEvent.UP)
return;
if (Modes.MODE_GROOVE.equals(modeManager.getActiveModeId()))
modeManager.restoreMode();
else
this.quantize();
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class RasteredKnobCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final int value) {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
final DeviceBrowserMode mode = (DeviceBrowserMode) modeManager.getMode(Modes.MODE_BROWSER);
mode.changeSelectedColumnValue(value);
return;
}
this.model.getTransport().changeTempo(value == 1);
}
Aggregations