use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final ICursorDevice cd = this.model.getCursorDevice();
int index = this.isButtonRow(0, buttonID);
if (index >= 0) {
if (!cd.doesExist())
return super.getButtonColor(buttonID);
final int selectedColor = this.colorManager.getColorIndex(PushColorManager.PUSH_ORANGE_HI);
final int existsColor = this.colorManager.getColorIndex(PushColorManager.PUSH_YELLOW_LO);
final int offColor = this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
if (this.showDevices) {
final IDeviceBank bank = cd.getDeviceBank();
if (!bank.getItem(index).doesExist())
return offColor;
return index == cd.getIndex() ? selectedColor : existsColor;
}
final IParameterPageBank bank = cd.getParameterPageBank();
final int selectedItemIndex = bank.getSelectedItemIndex();
if (bank.getItem(index).isEmpty())
return offColor;
return index == selectedItemIndex ? selectedColor : existsColor;
}
index = this.isButtonRow(1, buttonID);
if (index >= 0) {
final int white = this.isPush2 ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH1_COLOR2_WHITE;
if (!cd.doesExist())
return index == 7 ? white : super.getButtonColor(buttonID);
final int green = this.isPush2 ? PushColorManager.PUSH2_COLOR2_GREEN : PushColorManager.PUSH1_COLOR2_GREEN;
final int grey = this.isPush2 ? PushColorManager.PUSH2_COLOR2_GREY_LO : PushColorManager.PUSH1_COLOR2_GREY_LO;
final int orange = this.isPush2 ? PushColorManager.PUSH2_COLOR2_ORANGE : PushColorManager.PUSH1_COLOR2_ORANGE;
final int off = this.isPush2 ? PushColorManager.PUSH2_COLOR_BLACK : PushColorManager.PUSH1_COLOR_BLACK;
final int turquoise = this.isPush2 ? PushColorManager.PUSH2_COLOR2_TURQUOISE_HI : PushColorManager.PUSH1_COLOR2_TURQUOISE_HI;
switch(index) {
case 0:
return cd.isEnabled() ? green : grey;
case 1:
return cd.isParameterPageSectionVisible() ? orange : white;
case 2:
return cd.isExpanded() ? orange : white;
case 3:
return this.surface.getModeManager().isActive(Modes.DEVICE_CHAINS) ? orange : white;
case 4:
return this.showDevices ? white : orange;
case 5:
if (!this.model.getHost().supports(Capability.HAS_PINNING))
return off;
return cd.isPinned() ? turquoise : grey;
case 6:
return cd.isWindowOpen() ? turquoise : grey;
default:
case 7:
return white;
}
}
return super.getButtonColor(buttonID);
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists2(display, cd))
return;
final String color = this.model.getCurrentTrackBank().getSelectedChannelColorEntry();
final ColorEx bottomMenuColor = DAWColor.getColorEntry(color);
final IDeviceBank deviceBank = cd.getDeviceBank();
final IParameterBank parameterBank = cd.getParameterBank();
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
final int selectedPage = parameterPageBank.getSelectedItemIndex();
final boolean hasPinning = this.model.getHost().supports(Capability.HAS_PINNING);
final IValueChanger valueChanger = this.model.getValueChanger();
for (int i = 0; i < parameterBank.getPageSize(); i++) {
final boolean isTopMenuOn = this.getTopMenuEnablement(cd, hasPinning, i);
String bottomMenu;
final String bottomMenuIcon;
boolean isBottomMenuOn;
if (this.showDevices) {
final IDevice item = deviceBank.getItem(i);
bottomMenuIcon = item.getName();
bottomMenu = item.doesExist() ? item.getName(12) : "";
isBottomMenuOn = i == cd.getIndex();
} else {
bottomMenuIcon = cd.getName();
bottomMenu = parameterPageBank.getItem(i);
if (bottomMenu.length() > 12)
bottomMenu = bottomMenu.substring(0, 12);
isBottomMenuOn = i == selectedPage;
}
final IParameter param = parameterBank.getItem(i);
final boolean exists = param.doesExist();
final String parameterName = exists ? param.getName(9) : "";
final int parameterValue = valueChanger.toDisplayValue(exists ? param.getValue() : 0);
final String parameterValueStr = exists ? param.getDisplayedValue(8) : "";
final boolean parameterIsActive = this.isKnobTouched[i];
final int parameterModulatedValue = valueChanger.toDisplayValue(exists ? param.getModulatedValue() : -1);
display.addParameterElement(this.hostMenu[i], isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
}
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class ParametersMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
// Colors in combination with Shift
if (this.surface.isShiftPressed())
return this.getButtonColorShifted(buttonID);
// Colors in combination with Arrow Up
if (this.surface.isLongPressed(ButtonID.ARROW_UP))
return this.getButtonColorArrowUp(buttonID);
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist())
return 0;
// Colors normal behavior
final int index = buttonID.ordinal() - ButtonID.ROW1_1.ordinal();
if (this.showDevices) {
final IDeviceBank bank = cd.getDeviceBank();
final IDevice item = bank.getItem(index);
if (!item.doesExist())
return SLMkIIIColorManager.SLMKIII_BLACK;
return index == cd.getIndex() ? SLMkIIIColorManager.SLMKIII_MINT : SLMkIIIColorManager.SLMKIII_MINT_HALF;
}
final IParameterPageBank bank = cd.getParameterPageBank();
final int selectedItemIndex = bank.getSelectedItemIndex();
if (bank.getItem(index).isEmpty())
return SLMkIIIColorManager.SLMKIII_BLACK;
return index == selectedItemIndex ? SLMkIIIColorManager.SLMKIII_PURPLE : SLMkIIIColorManager.SLMKIII_PURPLE_HALF;
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class DeviceView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ICursorDevice cd = this.model.getCursorDevice();
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
final int selectedItemIndex = parameterPageBank.getSelectedItemIndex();
final IPadGrid padGrid = this.surface.getPadGrid();
for (int i = 0; i < parameterPageBank.getPageSize(); i++) padGrid.light(44 + i, i == selectedItemIndex ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE : BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
padGrid.light(36, cd.isEnabled() ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED : BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
padGrid.light(37, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
padGrid.light(38, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
padGrid.light(39, BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED);
padGrid.light(40, BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED);
padGrid.light(41, BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
padGrid.light(42, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
padGrid.light(43, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
}
use of de.mossgrabers.framework.daw.data.bank.IParameterPageBank in project DrivenByMoss by git-moss.
the class ParameterMode method getSelectedItemName.
/**
* {@inheritDoc}
*/
@Override
public Optional<String> getSelectedItemName() {
if (!this.cursorDevice.doesExist())
return Optional.empty();
final IParameterPageBank parameterPageBank = this.cursorDevice.getParameterPageBank();
final Optional<String> selectedItem = parameterPageBank.getSelectedItem();
String value = this.cursorDevice.getName();
if (selectedItem.isPresent())
value += " - " + selectedItem.get();
return Optional.of(value);
}
Aggregations