use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class LaunchpadToggleShiftViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
final ViewManager viewManager = this.surface.getViewManager();
if (event == ButtonEvent.DOWN && (viewManager.isActive(Views.TEMPO) || viewManager.isActive(Views.SHUFFLE))) {
viewManager.restore();
this.surface.setTriggerConsumed(ButtonID.SHIFT);
return;
}
super.execute(event, velocity);
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class SelectDeviceViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (this.surface.isPro() && this.surface.isShiftPressed()) {
if (viewManager.isActive(Views.SHIFT))
viewManager.restore();
viewManager.setTemporary(Views.TEMPO);
this.surface.getDisplay().notify(viewManager.getActive().getName());
return;
}
final IBrowser browser = this.model.getBrowser();
if (viewManager.isActive(Views.BROWSER)) {
browser.stopBrowsing(false);
viewManager.setActive(Views.DEVICE);
this.surface.getDisplay().notify(viewManager.getActive().getName());
return;
}
if (viewManager.isActive(Views.DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (this.surface.isShiftPressed() || !cursorDevice.doesExist())
browser.insertAfterCursorDevice();
else
browser.replace(cursorDevice);
return;
}
viewManager.setActive(Views.DEVICE);
this.surface.getDisplay().notify(viewManager.getActive().getName());
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class NoteViewSelectView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ViewManager viewManager = this.surface.getViewManager();
final Views previousViewId = viewManager.getPreviousID();
final IPadGrid padGrid = this.surface.getPadGrid();
for (int i = 36; i < 60; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(60, previousViewId == Views.SEQUENCER ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER_HI);
padGrid.light(61, previousViewId == Views.POLY_SEQUENCER ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER_LO);
padGrid.light(62, previousViewId == Views.RAINDROPS ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER);
for (int i = 63; i < 76; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(76, previousViewId == Views.DRUM ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_HI);
padGrid.light(77, previousViewId == Views.DRUM4 ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE);
padGrid.light(78, previousViewId == Views.DRUM8 ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_LO);
for (int i = 79; i < 92; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(92, previousViewId == Views.PLAY ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_HI);
padGrid.light(93, previousViewId == Views.PIANO ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_RED);
padGrid.light(94, previousViewId == Views.DRUM64 ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_LO);
for (int i = 95; i < 100; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class SelectNoteViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.UP)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActive(Views.CONTROL)) {
viewManager.restore();
this.surface.getDisplay().notify(viewManager.getActive().getName());
return;
}
Views viewID = viewManager.getActiveID();
if (Views.isNoteView(viewID) || Views.isSequencerView(viewID)) {
viewManager.setActive(Views.CONTROL);
this.surface.getDisplay().notify("Note / sequencer mode selection");
return;
}
final ITrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist()) {
viewManager.setActive(Views.SESSION);
this.surface.getDisplay().notify("Session");
return;
}
viewID = viewManager.getPreferredView(cursorTrack.getPosition());
if (viewID == null)
viewID = Views.PLAY;
viewManager.setActive(viewID);
this.surface.getDisplay().notify(viewManager.get(viewID).getName());
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class AbstractTriggerCommand method activatePreferredView.
/**
* Activates the given view and stores it as the preferred view for the currently active track.
*
* @param viewID The ID of the view to activate and store
*/
protected void activatePreferredView(final Views viewID) {
if (viewID == null)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.get(viewID) == null)
return;
viewManager.setActive(viewID);
final ITrack cursorTrack = this.model.getCursorTrack();
if (cursorTrack.doesExist())
viewManager.setPreferredView(cursorTrack.getPosition(), viewID);
}
Aggregations