Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
decimal.h
1/*
2 * Copyright © 2017-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
20#include "number.h"
21
22namespace deluge::gui::menu_item {
23
24class Decimal : public Number {
25public:
26 using Number::Number;
27 void beginSession(MenuItem* navigatedBackwardFrom = nullptr) override;
28 void selectEncoderAction(int32_t offset) override;
29 void horizontalEncoderAction(int32_t offset) override;
30
31protected:
32 void drawValue() override;
33 [[nodiscard]] virtual int32_t getNumDecimalPlaces() const = 0;
34 [[nodiscard]] virtual int32_t getDefaultEditPos() const { return 2; }
35
36 void drawPixelsForOled() override;
37
38 // 7Seg Only
39 virtual void drawActualValue(bool justDidHorizontalScroll = false);
40
41private:
42 void scrollToGoodPos();
43};
44
46 using Decimal::Decimal;
47
48public:
49 void selectEncoderAction(int32_t offset) override;
50 void horizontalEncoderAction(int32_t offset) override { return; }
51
52protected:
53 virtual float getDisplayValue() { return this->getValue(); }
54 virtual const char* getUnit() { return ""; }
55
56 void drawPixelsForOled() override;
57 void drawDecimal(int32_t textWidth, int32_t textHeight, int32_t yPixel);
58 // 7Seg Only
59 void drawActualValue(bool justDidHorizontalScroll = false) override;
60};
61
62} // namespace deluge::gui::menu_item
void horizontalEncoderAction(int32_t offset) override
Handle horizontal encoder movement.
Definition decimal.h:50
void drawPixelsForOled() override
Paints the pixels below the standard title block.
Definition decimal.cpp:228
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition decimal.cpp:204
Definition decimal.h:24
void beginSession(MenuItem *navigatedBackwardFrom=nullptr) override
Begin an editing session with this menu item.
Definition decimal.cpp:32
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition decimal.cpp:55
void drawPixelsForOled() override
Paints the pixels below the standard title block.
Definition decimal.cpp:133
void horizontalEncoderAction(int32_t offset) override
Handle horizontal encoder movement.
Definition decimal.cpp:82
Definition number.h:24