32 using Selection::Selection;
34 void readCurrentValue()
override { this->setValue(soundEditor.currentModControllable->modFXType_); }
36 void writeCurrentValue()
override {
37 auto current_value = this->getValue<ModFXType>();
39 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
41 Kit* kit = getCurrentKit();
43 bool some_error =
false;
44 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
45 if (thisDrum->type == DrumType::SOUND) {
46 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
47 if (!soundDrum->setModFXType(current_value)) {
53 display->displayError(Error::INSUFFICIENT_RAM);
58 if (!soundEditor.currentModControllable->setModFXType(current_value)) {
59 display->displayError(Error::INSUFFICIENT_RAM);
64 deluge::vector<std::string_view> getOptions(OptType optType)
override {
66 return modfx::getModNames();
77 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
80 DEF_STACK_STRING_BUF(shortOpt, kShortStringBufferSize);
83 constexpr int32_t arrowSpace = 10;
86 int32_t textWidth = image.getStringWidthInPixels(shortOpt.c_str(), kTextSpacingY);
87 while (textWidth >= width - 2 * arrowSpace) {
88 shortOpt.truncate(shortOpt.size() - 1);
89 textWidth = image.getStringWidthInPixels(shortOpt.c_str(), kTextSpacingY);
92 const int32_t textStartX = startX + (width - textWidth) / 2 + 1;
93 const int32_t textStartY = startY + (height - kTextSpacingY) / 2 + 1;
97 image.drawString(
"<", startX + 5, textStartY, kTextTitleSpacingX, kTextTitleSizeY);
101 image.drawString(shortOpt.c_str(), textStartX, textStartY, kTextSpacingX, kTextSpacingY);
104 constexpr int32_t highlightOffset = 21;
105 switch (FlashStorage::accessibilityMenuHighlighting) {
106 case MenuHighlighting::FULL_INVERSION:
107 image.invertAreaRounded(startX + highlightOffset, width - highlightOffset * 2, textStartY - 2,
108 textStartY + kTextSpacingY + 1);
110 case MenuHighlighting::PARTIAL_INVERSION:
111 image.drawRectangleRounded(startX + highlightOffset, textStartY - 3, startX + width - highlightOffset,
112 textStartY + kTextSpacingY + 2, oled_canvas::BorderRadius::BIG);
114 case MenuHighlighting::NO_INVERSION:
119 if (getValue() < size() - 1) {
120 image.drawString(
">", OLED_MAIN_WIDTH_PIXELS - arrowSpace, textStartY, kTextTitleSpacingX, kTextTitleSizeY);