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
96 virtual ActionResult padAction(int32_t x, int32_t y, int32_t velocity) {
return ActionResult::DEALT_WITH; }
97 virtual ActionResult buttonAction(deluge::hid::Button b,
bool on,
bool inCardRoutine) {
98 return ActionResult::NOT_DEALT_WITH;
100 virtual ActionResult horizontalEncoderAction(int32_t offset) {
return ActionResult::DEALT_WITH; }
101 virtual ActionResult verticalEncoderAction(int32_t offset,
bool inCardRoutine) {
return ActionResult::DEALT_WITH; }
102 virtual void selectEncoderAction(int8_t offset) {}
103 virtual void modEncoderAction(int32_t whichModEncoder, int32_t offset);
104 virtual void modButtonAction(uint8_t whichButton,
bool on);
105 virtual void modEncoderButtonAction(uint8_t whichModEncoder,
bool on);
107 virtual void graphicsRoutine();
108 virtual ActionResult timerCallback() {
return ActionResult::DEALT_WITH; }
110 virtual bool opened() {
115 virtual void focusRegained() {}
117 virtual void displayOrLanguageChanged() {}
118 virtual bool canSeeViewUnderneath() {
return false; }
128 virtual void scrollFinished() {}
129 virtual bool pcReceivedForMidiLearn(MIDICable& fromCable, int32_t channel, int32_t program) {
return false; }
131 virtual bool noteOnReceivedForMidiLearn(MIDICable& fromCable, int32_t channel, int32_t note, int32_t velocity) {
135 virtual bool getGreyoutColsAndRows(uint32_t* cols, uint32_t* rows) {
142 virtual bool renderMainPads(uint32_t whichRows = 0, RGB image[][kDisplayWidth + kSideBarWidth] =
nullptr,
143 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth] =
nullptr,
144 bool drawUndefinedArea =
true) {
147 virtual bool renderSidebar(uint32_t whichRows = 0, RGB image[][kDisplayWidth + kSideBarWidth] =
nullptr,
148 uint8_t occupancyMask[][kDisplayWidth + kSideBarWidth] =
nullptr) {
157 bool oledShowsUIUnderneath;
161 virtual UI*
getUI() {
return this; }
170#if ENABLE_MATRIX_DEBUG
171 const char* getUIName();
181UI* getUIUpOneLevel(int32_t numLevelsUp);
182static UI* getUIUpOneLevel() {
183 return getUIUpOneLevel(1);
186bool openUI(
UI* newUI);
187void changeRootUI(
UI* newUI);
188bool changeUISideways(
UI* newUI);
189bool changeUIAtLevel(
UI* newUI, int32_t level);
190bool isUIOpen(
UI* ui);
191void setRootUILowLevel(
UI* newUI);
192void swapOutRootUILowLevel(
UI* newUI);
194bool currentUIIsClipMinderScreen();
195bool rootUIIsClipMinderScreen();
196std::pair<uint32_t, uint32_t> getUIGreyoutColsAndRows();
198void uiNeedsRendering(
UI* ui, uint32_t whichMainRows = 0xFFFFFFFF, uint32_t whichSideRows = 0xFFFFFFFF);
199void renderingNeededRegardlessOfUI(uint32_t whichMainRows = 0xFFFFFFFF, uint32_t whichSideRows = 0xFFFFFFFF);
200void clearPendingUIRendering();
202void doAnyPendingUIRendering();
204void renderUIsForOled();
207bool isUIModeActive(uint32_t uiMode);
208bool isUIModeActiveExclusively(uint32_t uiMode);
209bool isUIModeWithinRange(
const uint32_t* modes);
210bool isNoUIModeActive();
211void exitUIMode(uint32_t uiMode);
212void 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:161
virtual bool exitUI()
returns whether a UI exited
Definition ui.h:153
virtual TimelineView * toTimelineView()
Convert this view to a TimelineView.
Definition ui.h:126
virtual UIType getUIContextType()
What context does UI relate to? e.g. UIType could be AUTOMATION but UIContextType could be ARRANGER,...
Definition ui.h:166
virtual ClipMinder * toClipMinder()
Definition ui.h:121
virtual UIModControllableContext getUIModControllableContext()
What mod controllable context is this UI using? E.g. Automation View can use the Song ModControllable...
Definition ui.h:169
virtual UIType getUIType()=0
What type of UI is this? e.g. UIType::ARRANGER.