20#include "definitions_cxx.hpp"
21#include "gui/colour/colour.h"
22#include "hid/button.h"
23#include "hid/display/oled_canvas/canvas.h"
30extern uint32_t currentUIMode;
31extern bool pendingUIRenderingLock;
35#define UI_MODE_HORIZONTAL_ZOOM 2
36#define UI_MODE_VERTICAL_SCROLL 1
37#define UI_MODE_INSTRUMENT_CLIP_COLLAPSING 4
38#define UI_MODE_INSTRUMENT_CLIP_EXPANDING 5
39#define UI_MODE_NOTEROWS_EXPANDING_OR_COLLAPSING 7
40#define UI_MODE_CLIP_PRESSED_IN_SONG_VIEW 9
41#define UI_MODE_MIDI_LEARN 11
42#define UI_MODE_NOTES_PRESSED 12
43#define UI_MODE_SCALE_MODE_BUTTON_PRESSED 14
44#define UI_MODE_SOLO_BUTTON_HELD 15
46#define UI_MODE_WAITING_FOR_NEXT_FILE_TO_LOAD 27
47#define UI_MODE_ADDING_DRUM_NOTEROW 28
48#define UI_MODE_CREATING_CLIP 29
50#define UI_MODE_LOADING_BUT_ABORT_IF_SELECT_ENCODER_TURNED 33
51#define UI_MODE_LOADING_SONG_ESSENTIAL_SAMPLES 34
52#define UI_MODE_LOADING_SONG_UNESSENTIAL_SAMPLES_UNARMED 35
53#define UI_MODE_LOADING_SONG_UNESSENTIAL_SAMPLES_ARMED 36
54#define UI_MODE_LOADING_SONG_NEW_SONG_PLAYING 37
55#define UI_MODE_SELECTING_MIDI_CC 38
56#define UI_MODE_HOLDING_SECTION_PAD 40
57#define UI_MODE_HOLDING_ARRANGEMENT_ROW_AUDITION 41
58#define UI_MODE_HOLDING_ARRANGEMENT_ROW 42
59#define UI_MODE_EXPLODE_ANIMATION 43
60#define UI_MODE_ANIMATION_FADE 44
61#define UI_MODE_RECORD_COUNT_IN 45
62#define UI_MODE_HOLDING_SAMPLE_MARKER 46
63#define UI_MODE_HOLDING_BUTTON_POTENTIAL_LONG_PRESS 47
64#define UI_MODE_HOLDING_AFFECT_ENTIRE_IN_SOUND_EDITOR 48
65#define UI_MODE_HOLDING_BACKSPACE 49
66#define UI_MODE_VIEWING_RECORD_ARMING 50
67#define UI_MODE_HOLDING_SAVE_BUTTON 51
68#define UI_MODE_HOLDING_LOAD_BUTTON 52
69#define UI_MODE_PREDICTING_QWERTY_TEXT 53
70#define UI_MODE_AUDIO_CLIP_EXPANDING 54
71#define UI_MODE_AUDIO_CLIP_COLLAPSING 55
72#define UI_MODE_MODULATING_PARAM_HOLDING_ENCODER_DOWN 58
73#define UI_MODE_PATCHING_SOURCE_HOLDING_BUTTON_DOWN 59
74#define UI_MODE_MACRO_SETTING_UP 60
75#define UI_MODE_DRAGGING_KIT_NOTEROW 61
76#define UI_MODE_HOLDING_STATUS_PAD 62
77#define UI_MODE_IMPLODE_ANIMATION 63
78#define UI_MODE_STEM_EXPORT 64
79#define UI_MODE_HOLDING_SONG_BUTTON 65
81#define EXCLUSIVE_UI_MODES_MASK ((uint32_t)255)
85#define UI_MODE_QUANTIZE (1 << 27)
86#define UI_MODE_STUTTERING (1 << 28)
87#define UI_MODE_HORIZONTAL_SCROLL (1 << 29)
88#define UI_MODE_AUDITIONING (1 << 30)
89#define UI_MODE_HOLDING_HORIZONTAL_ENCODER_BUTTON ((uint32_t)1 << 31)
91#define LONG_PRESS_DURATION 400
94 virtual ~UI() =
default;
97 virtual ActionResult padAction(int32_t x, int32_t y, int32_t velocity) {
return ActionResult::DEALT_WITH; }
98 virtual ActionResult buttonAction(deluge::hid::Button b,
bool on,
bool inCardRoutine) {
99 return ActionResult::NOT_DEALT_WITH;
101 virtual ActionResult horizontalEncoderAction(int32_t offset) {
return ActionResult::DEALT_WITH; }
102 virtual ActionResult verticalEncoderAction(int32_t offset,
bool inCardRoutine) {
return ActionResult::DEALT_WITH; }
103 virtual void selectEncoderAction(int8_t offset) {}
104 virtual void modEncoderAction(int32_t whichModEncoder, int32_t offset);
105 virtual void modButtonAction(uint8_t whichButton,
bool on);
106 virtual void modEncoderButtonAction(uint8_t whichModEncoder,
bool on);
108 virtual void graphicsRoutine();
109 virtual ActionResult timerCallback() {
return ActionResult::DEALT_WITH; }
111 virtual bool opened() {
116 virtual void focusRegained() {}
118 virtual void displayOrLanguageChanged() {}
119 virtual bool canSeeViewUnderneath() {
return false; }
129 virtual void scrollFinished() {}
130 virtual bool pcReceivedForMidiLearn(MIDICable& fromCable, int32_t channel, int32_t program) {
return false; }
132 virtual bool noteOnReceivedForMidiLearn(MIDICable& fromCable, int32_t channel, int32_t note, int32_t velocity) {
136 virtual bool getGreyoutColsAndRows(uint32_t* cols, uint32_t* rows) {
143 virtual bool renderMainPads(uint32_t whichRows = 0, RGB image[][kDisplayWidth + kSideBarWidth] =
nullptr,
144 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth] =
nullptr,
145 bool drawUndefinedArea =
true) {
148 virtual bool renderSidebar(uint32_t whichRows = 0, RGB image[][kDisplayWidth + kSideBarWidth] =
nullptr,
149 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth] =
nullptr) {
158 bool oledShowsUIUnderneath;
162 virtual UI*
getUI() {
return this; }
171#if ENABLE_MATRIX_DEBUG
172 const char* getUIName();
182UI* getUIUpOneLevel(int32_t numLevelsUp);
183static UI* getUIUpOneLevel() {
184 return getUIUpOneLevel(1);
187bool openUI(
UI* newUI);
188void changeRootUI(
UI* newUI);
189bool changeUISideways(
UI* newUI);
190bool changeUIAtLevel(
UI* newUI, int32_t level);
191bool isUIOpen(
UI* ui);
192void setRootUILowLevel(
UI* newUI);
193void swapOutRootUILowLevel(
UI* newUI);
195bool currentUIIsClipMinderScreen();
196bool rootUIIsClipMinderScreen();
197std::pair<uint32_t, uint32_t> getUIGreyoutColsAndRows();
199void uiNeedsRendering(
UI* ui, uint32_t whichMainRows = 0xFFFFFFFF, uint32_t whichSideRows = 0xFFFFFFFF);
200void renderingNeededRegardlessOfUI(uint32_t whichMainRows = 0xFFFFFFFF, uint32_t whichSideRows = 0xFFFFFFFF);
201void clearPendingUIRendering();
203void doAnyPendingUIRendering();
205void renderUIsForOled();
208bool isUIModeActive(uint32_t uiMode);
209bool isUIModeActiveExclusively(uint32_t uiMode);
210bool isUIModeWithinRange(
const uint32_t* modes);
211bool isNoUIModeActive();
212void exitUIMode(uint32_t uiMode);
213void enterUIMode(uint32_t uiMode);
Definition clip_minder.h:23
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:94
Definition timeline_view.h:27
virtual UI * getUI()
When entering a UI (e.g. automationView), you may wish to open a different UI based on the current co...
Definition ui.h:162
virtual bool exitUI()
returns whether a UI exited
Definition ui.h:154
virtual TimelineView * toTimelineView()
Convert this view to a TimelineView.
Definition ui.h:127
virtual UIType getUIContextType()
What context does UI relate to? e.g. UIType could be AUTOMATION but UIContextType could be ARRANGER,...
Definition ui.h:167
virtual ClipMinder * toClipMinder()
Definition ui.h:122
virtual UIModControllableContext getUIModControllableContext()
What mod controllable context is this UI using? E.g. Automation View can use the Song ModControllable...
Definition ui.h:170
virtual UIType getUIType()=0
What type of UI is this? e.g. UIType::ARRANGER.