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();
74 void renderInHorizontalMenu(int32_t startX, int32_t width, int32_t startY, int32_t height)
override {
77 DEF_STACK_STRING_BUF(shortOpt, kShortStringBufferSize);
80 constexpr int32_t arrowSpace = 10;
83 int32_t pxLen = image.getStringWidthInPixels(shortOpt.c_str(), kTextSpacingY);
84 while (pxLen >= width - (2 * arrowSpace)) {
85 shortOpt.truncate(shortOpt.size() - 1);
86 pxLen = image.getStringWidthInPixels(shortOpt.c_str(), kTextSpacingY);
90 int32_t textStartX = startX + ((width - pxLen) / 2);
91 int32_t textStartY = startY + ((height - kTextSpacingY) / 2) + 1;
95 image.drawString(
"<", startX + 2, textStartY, kTextTitleSpacingX, kTextTitleSizeY);
99 image.drawString(shortOpt.c_str(), textStartX, textStartY, kTextSpacingX, kTextSpacingY);
101 if (getValue() < size() - 1) {
102 image.drawString(
">", OLED_MAIN_WIDTH_PIXELS - arrowSpace, textStartY, kTextTitleSpacingX, kTextTitleSizeY);