Deluge Firmware
1.3.0
Build date: 2026.08.29
Toggle main menu visibility
Loading...
Searching...
No Matches
editing_mode.h
1
/*
2
* Copyright (c) 2023 Sean Ditny
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 "definitions_cxx.hpp"
20
#include "gui/menu_item/selection.h"
21
#include "gui/ui/ui.h"
22
#include "gui/views/performance_view.h"
23
#include "hid/led/indicator_leds.h"
24
#include "model/model_stack.h"
25
#include "model/song/song.h"
26
27
namespace
deluge::gui::menu_item::performance_session_view {
28
class
EditingMode
final :
public
Selection
{
29
public
:
30
using
Selection::Selection;
31
32
PerformanceEditingMode currentMode;
33
34
void
readCurrentValue
()
override
{
35
if
(!performanceView.defaultEditingMode) {
36
currentMode = PerformanceEditingMode::DISABLED;
37
}
38
else
if
(!performanceView.editingParam) {
39
currentMode = PerformanceEditingMode::VALUE;
40
}
41
else
{
42
currentMode = PerformanceEditingMode::PARAM;
43
}
44
this->setValue(currentMode);
45
}
46
47
void
writeCurrentValue()
override
{ currentMode = this->getValue<PerformanceEditingMode>(); }
48
49
MenuItem*
selectButtonPress
()
override
{
50
if
(currentMode == PerformanceEditingMode::DISABLED) {
51
return
nullptr
;
// go up a level
52
}
53
// here we're going to want to step into the value editing or param editing UI
54
else
if
(currentMode == PerformanceEditingMode::VALUE) {
55
performanceView.defaultEditingMode =
true
;
56
performanceView.editingParam =
false
;
57
}
58
else
{
// PerformanceEditingMode::PARAM
59
performanceView.defaultEditingMode =
true
;
60
performanceView.editingParam =
true
;
61
}
62
63
if
(!performanceView.editingParam) {
64
// reset performance view when you switch modes
65
// but not when in param editing mode cause that would reset param assignments to FX columns
66
char
modelStackMemory[MODEL_STACK_MAX_SIZE];
67
ModelStackWithThreeMainThings
* modelStack =
68
currentSong->setupModelStackWithSongAsTimelineCounter(modelStackMemory);
69
performanceView.resetPerformanceView(modelStack);
70
}
71
72
display->setNextTransitionDirection(1);
73
openUI(&performanceView);
74
return
NO_NAVIGATION;
75
}
76
77
deluge::vector<std::string_view> getOptions(OptType optType)
override
{
78
(void)optType;
79
using
enum l10n::String;
80
return
{
81
l10n::getView(STRING_FOR_DISABLED),
82
l10n::getView(STRING_FOR_PERFORM_EDIT_VALUE),
83
l10n::getView(STRING_FOR_PERFORM_EDIT_PARAM),
84
};
85
}
86
};
87
88
}
// namespace deluge::gui::menu_item::performance_session_view
ModelStackWithThreeMainThings
Definition
model_stack.h:231
deluge::gui::menu_item::Selection
Definition
selection.h:26
deluge::gui::menu_item::performance_session_view::EditingMode
Definition
editing_mode.h:28
deluge::gui::menu_item::performance_session_view::EditingMode::readCurrentValue
void readCurrentValue() override
Like readValueAgain, but does not redraw.
Definition
editing_mode.h:34
deluge::gui::menu_item::performance_session_view::EditingMode::selectButtonPress
MenuItem * selectButtonPress() override
Handle a select button press.
Definition
editing_mode.h:49