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