use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class SelectPlayViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (Views.isSessionView(viewManager.getActiveViewId())) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selectedTrack = tb.getSelectedTrack();
if (selectedTrack == null) {
this.surface.getDisplay().notify("Please select a track first.");
return;
}
final Integer preferredView = viewManager.getPreferredView(selectedTrack.getPosition());
viewManager.setActiveView(preferredView == null ? Views.VIEW_PLAY : preferredView);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_VIEW_SELECT))
modeManager.restoreMode();
else
modeManager.setActiveMode(Modes.MODE_VIEW_SELECT);
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class MastertrackCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
// Avoid accidentally leaving the browser
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_BROWSER))
return;
switch(event) {
case DOWN:
this.quitMasterMode = false;
break;
case UP:
this.handleButtonUp(modeManager);
break;
case LONG:
this.quitMasterMode = true;
modeManager.setActiveMode(Modes.MODE_FRAME);
break;
}
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class VolumeCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Integer currentMode = modeManager.getActiveModeId();
// Layer mode selection for Push 1
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME);
return;
}
if (Modes.MODE_VOLUME.equals(currentMode))
modeManager.setActiveMode(Modes.MODE_CROSSFADER);
else
modeManager.setActiveMode(Modes.MODE_VOLUME);
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class SLControllerSetup method createModel.
/**
* {@inheritDoc}
*/
@Override
protected void createModel() {
this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, 6, 16, 16, true, -1, -1, -1, -1);
this.model.getTrackBank().addTrackSelectionObserver(this::handleTrackChange);
this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
if (!isSelected)
return;
final ModeManager modeManager = this.getSurface().getModeManager();
if (!modeManager.isActiveMode(Modes.MODE_VOLUME))
modeManager.setActiveMode(Modes.MODE_MASTER);
});
}
use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.
the class ControlView method onButtonP1.
/**
* {@inheritDoc}
*/
@Override
public void onButtonP1(final boolean isUp, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Integer activeModeId = modeManager.getActiveModeId();
if (activeModeId == Modes.MODE_FUNCTIONS || activeModeId == Modes.MODE_FIXED)
this.onButtonRow1Select();
else if (activeModeId == Modes.MODE_VOLUME)
new P2ButtonCommand(isUp, this.model, this.surface).execute(event);
else if (activeModeId == Modes.MODE_TRACK || activeModeId == Modes.MODE_MASTER)
new ButtonRowSelectCommand<>(3, this.model, this.surface).execute(event);
else if (activeModeId == Modes.MODE_TRACK_TOGGLES || activeModeId == Modes.MODE_FRAME)
this.onButtonRow2Select();
else {
if (isUp)
((DeviceParamsMode) modeManager.getMode(Modes.MODE_PARAMS)).nextPage();
else
((DeviceParamsMode) modeManager.getMode(Modes.MODE_PARAMS)).previousPage();
}
}
Aggregations