30 using Selection::Selection;
31 void readCurrentValue()
override { this->setValue<::FilterRoute>(soundEditor.currentModControllable->filterRoute); }
34 void writeCurrentValue()
override {
35 auto current_value = this->getValue<::FilterRoute>();
38 if (currentUIMode == UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR && soundEditor.editingKitRow()) {
40 Kit* kit = getCurrentKit();
42 for (
Drum* thisDrum = kit->firstDrum; thisDrum !=
nullptr; thisDrum = thisDrum->next) {
43 if (thisDrum->type == DrumType::SOUND) {
44 auto* soundDrum =
static_cast<SoundDrum*
>(thisDrum);
46 if (soundDrum->lpfMode != FilterMode::OFF && soundDrum->hpfMode != FilterMode::OFF) {
47 soundDrum->filterRoute = current_value;
54 soundEditor.currentModControllable->filterRoute = current_value;
58 deluge::vector<std::string_view> getOptions(OptType optType)
override {
60 return {optType == OptType::SHORT ?
"HPF > LPF" :
"HPF2LPF",
61 optType == OptType::SHORT ?
"LPF > HPF" :
"LPF2HPF", l10n::getView(l10n::String::STRING_FOR_PARALLEL)};
71 DEF_STACK_STRING_BUF(shortOpt, kShortStringBufferSize);
74 constexpr int32_t arrow_space = 10;
77 int32_t text_width = image.getStringWidthInPixels(shortOpt.c_str(), kTextSpacingY);
78 while (text_width >= slot.width - 2 * arrow_space) {
79 shortOpt.truncate(shortOpt.size() - 1);
80 text_width = image.getStringWidthInPixels(shortOpt.c_str(), kTextSpacingY);
83 const int32_t text_start_x = slot.start_x + (slot.width - text_width) / 2 + 1;
84 const int32_t text_start_y = slot.start_y + (slot.height - kTextSpacingY) / 2 + 1;
88 image.drawString(
"<", slot.start_x + 5, text_start_y, kTextTitleSpacingX, kTextTitleSizeY);
92 image.drawString(shortOpt.c_str(), text_start_x, text_start_y, kTextSpacingX, kTextSpacingY);
95 constexpr int32_t highlight_offset = 21;
96 switch (FlashStorage::accessibilityMenuHighlighting) {
97 case MenuHighlighting::FULL_INVERSION:
98 image.invertAreaRounded(slot.start_x + highlight_offset, slot.width - highlight_offset * 2,
99 text_start_y - 2, text_start_y + kTextSpacingY + 1);
101 case MenuHighlighting::PARTIAL_INVERSION:
102 case MenuHighlighting::NO_INVERSION:
103 image.drawRectangleRounded(slot.start_x + highlight_offset, text_start_y - 4,
104 slot.start_x + slot.width - highlight_offset, text_start_y + kTextSpacingY + 3,
105 oled_canvas::BorderRadius::BIG);
110 if (getValue() < size() - 1) {
111 image.drawString(
">", OLED_MAIN_WIDTH_PIXELS - arrow_space, text_start_y, kTextTitleSpacingX,