Deluge Firmware 1.3.0
Build date: 2025.06.05
Loading...
Searching...
No Matches
multi_range.h
1/*
2 * Copyright © 2018-2023 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19#include "menu_item.h"
20#include "range.h"
21
22namespace deluge::gui::menu_item {
23
24class MultiRange final : public Range {
25public:
26 using Range::Range;
27
28 void beginSession(MenuItem* navigatedBackwardFrom) override;
29 void selectEncoderAction(int32_t offset) override;
30 MenuItem* selectButtonPress() override;
31 void noteOnToChangeRange(int32_t noteCode);
32 bool isRangeDependent() override { return true; }
33 void deletePress();
34 MenuItem* menuItemHeadingTo;
35
36protected:
37 void getText(char* buffer, int32_t* getLeftLength = nullptr, int32_t* getRightLength = nullptr,
38
39 bool mayShowJustOne = true) override;
40 bool mayEditRangeEdge(RangeEdit whichEdge) override;
41
42 [[nodiscard]] std::string_view getTitle() const override {
43 return l10n::getView(l10n::String::STRING_FOR_NOTE_RANGE);
44 };
45 void drawPixelsForOled() override;
46
47 // NOTE: this isn't strictly speaking needed, but refactoring the selectEncoderAction() and
48 // displayPixelsForOled() to not use additional storage for scroll position was more work
49 // than Nikodemus wanted to do. See Selection, Enumeration, and Submenu for examples how it's done.
50 int32_t currentScroll = 0;
51};
52
53extern MultiRange multiRangeMenu;
54} // namespace deluge::gui::menu_item
Base class for all menu items.
Definition menu_item.h:39
Definition multi_range.h:23
Definition multi_range.h:24
void drawPixelsForOled() override
Paints the pixels below the standard title block.
Definition multi_range.cpp:427
MenuItem * selectButtonPress() override
Handle a select button press.
Definition multi_range.cpp:392
bool isRangeDependent() override
Returns true if this parameter is only relevant to some note ranges.
Definition multi_range.h:32
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition multi_range.cpp:38
std::string_view getTitle() const override
Get the title to be used when rendering on OLED, both as a deluge::gui::menu_item::Submenu and when d...
Definition multi_range.h:42
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition multi_range.cpp:68
Definition range.h:30