Deluge Firmware
1.3.0
Build date: 2026.11.28
Toggle main menu visibility
Loading...
Searching...
No Matches
param_locks.h
1
/*
2
* Copyright © 2026 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 "gui/menu_item/integer.h"
21
#include "gui/menu_item/menu_item.h"
22
#include "model/note/note_locks.h"
23
#include "util/containers.h"
24
25
namespace
deluge::gui::menu_item::note {
26
31
class
ParamLockValue
final :
public
Integer
{
32
public
:
33
using
Integer::Integer;
34
void
setParam(int32_t param) { param_ = param; }
35
[[nodiscard]] int32_t getMinValue()
const override
{
return
-64; }
36
[[nodiscard]] int32_t getMaxValue()
const override
{
return
64; }
37
[[nodiscard]] std::string_view
getTitle
()
const override
;
38
void
readCurrentValue
()
override
;
39
void
readValueAgain
()
override
;
40
void
selectEncoderAction
(int32_t offset)
override
;
41
void
endSession
()
override
;
43
void
commit
();
44
void
deletePress();
45
46
protected
:
47
int32_t getDisplayValue()
override
;
48
void
writeCurrentValue()
override
{ dirty_ =
true
; }
49
void
drawValue()
override
;
50
51
private
:
52
int32_t param_{0};
53
bool
dirty_{
false
};
54
};
55
58
class
ParamLocks
final :
public
MenuItem {
59
public
:
60
using
MenuItem::MenuItem;
61
void
beginSession
(MenuItem* navigatedBackwardFrom =
nullptr
)
override
;
62
void
readValueAgain
()
override
;
63
void
selectEncoderAction
(int32_t offset)
override
;
64
MenuItem*
selectButtonPress
()
override
;
65
bool
shouldEnterSubmenu
()
override
;
66
bool
isSubmenu()
override
{
return
true
; }
67
void
getColumnLabel(
StringBuf
& label)
override
{
68
label.append(l10n::get(l10n::String::STRING_FOR_NOTE_EDITOR_PARAM_LOCKS_SHORT));
69
}
70
void
renderInHorizontalMenu(
const
SlotPosition
& slot)
override
;
71
void
drawPixelsForOled
()
override
;
72
void
deletePress();
73
74
private
:
75
void
readLocks();
76
void
drawValue();
77
[[nodiscard]] int32_t numEntries()
const
{
return
locks_.size() + 1; }
// + "Clear all" / "None"
78
79
deluge::note_locks::LockSet
locks_;
80
deluge::vector<std::string_view> options_;
81
int32_t currentValue_{0};
82
int32_t scrollPos_{0};
83
};
84
85
}
// namespace deluge::gui::menu_item::note
StringBuf
Definition
d_stringbuf.h:16
deluge::gui::menu_item::Integer
Definition
integer.h:24
deluge::gui::menu_item::note::ParamLockValue
Definition
param_locks.h:31
deluge::gui::menu_item::note::ParamLockValue::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
param_locks.cpp:81
deluge::gui::menu_item::note::ParamLockValue::getTitle
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
param_locks.cpp:77
deluge::gui::menu_item::note::ParamLockValue::selectEncoderAction
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition
param_locks.cpp:105
deluge::gui::menu_item::note::ParamLockValue::endSession
void endSession() override
End an editing session with this menu item.
Definition
param_locks.cpp:133
deluge::gui::menu_item::note::ParamLockValue::readValueAgain
void readValueAgain() override
Re-read the value from the system and redraw the display to match.
Definition
param_locks.cpp:88
deluge::gui::menu_item::note::ParamLockValue::commit
void commit()
Writes a pending edit to the notes (once). Safe to call more than once.
Definition
param_locks.cpp:125
deluge::gui::menu_item::note::ParamLocks
Definition
param_locks.h:58
deluge::gui::menu_item::note::ParamLocks::beginSession
void beginSession(MenuItem *navigatedBackwardFrom=nullptr) override
Begin an editing session with this menu item.
Definition
param_locks.cpp:176
deluge::gui::menu_item::note::ParamLocks::selectButtonPress
MenuItem * selectButtonPress() override
Handle a select button press.
Definition
param_locks.cpp:219
deluge::gui::menu_item::note::ParamLocks::selectEncoderAction
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition
param_locks.cpp:210
deluge::gui::menu_item::note::ParamLocks::drawPixelsForOled
void drawPixelsForOled() override
Paints the pixels below the standard title block.
Definition
param_locks.cpp:194
deluge::gui::menu_item::note::ParamLocks::shouldEnterSubmenu
bool shouldEnterSubmenu() override
Check if selecting this menu item (with select encoder) should enter a submenu.
Definition
param_locks.cpp:148
deluge::gui::menu_item::note::ParamLocks::readValueAgain
void readValueAgain() override
Re-read the value from the system and redraw the display to match.
Definition
param_locks.cpp:184
deluge::note_locks::LockSet
Definition
note_locks.h:63
SlotPosition
Definition
menu_item.h:35