Deluge Firmware 1.3.0
Build date: 2026.07.30
Loading...
Searching...
No Matches
timeline_view.h
1/*
2 * Copyright © 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
18#pragma once
19
20#include "definitions_cxx.hpp"
21#include "gui/ui/root_ui.h"
22#include "hid/button.h"
23
24class InstrumentClip;
25class NoteRow;
26
27class TimelineView : public RootUI {
28public:
29 TimelineView() = default;
30
31 void scrollFinished() override;
32
33 TimelineView* toTimelineView() final { return this; }
34
35 virtual uint32_t getMaxZoom() = 0;
36 virtual bool calculateZoomPinSquares(uint32_t oldScroll, uint32_t newScroll, uint32_t newZoom,
37 uint32_t oldZoom); // Returns false if no animation needed
38 virtual uint32_t getMaxLength() = 0;
39 virtual bool setupScroll(uint32_t oldScroll); // Returns false if no animation needed
40 [[nodiscard]] virtual int32_t getNavSysId() const { return NAVIGATION_CLIP; }
41
42 // By default, animate every row during a zoom transition. A row that renders identically before and after simply
43 // animates invisibly, so skipping rows is only ever a micro-optimization (e.g. ArrangerView overrides this to skip
44 // empty output rows). SessionView doesn't use this; it does the equivalent a different way, in
45 // calculateZoomPinSquares().
46 virtual void tellMatrixDriverWhichRowsContainSomethingZoomable();
47
48 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) override;
49 void displayZoomLevel(bool justPopup = false);
50 ActionResult horizontalEncoderAction(int32_t offset) override;
51 void displayScrollPos();
52 void displayNumberOfBarsAndBeats(uint32_t number, uint32_t quantization, bool countFromOne,
53 char const* tooLongText);
54 void initiateXScroll(uint32_t newXScroll, int32_t numSquaresToScroll = kDisplayWidth);
55 bool zoomToMax(bool inOnly = false);
56 void initiateXZoom(int32_t zoomMagnitude, int32_t newScroll, uint32_t oldZoom);
57 void midiLearnFlash() override;
58
59 bool scrollRightToEndOfLengthIfNecessary(int32_t maxLength);
60
61 bool scrollLeftIfTooFarRight(int32_t maxLength);
62
63 void tripletsButtonPressed();
64 void setTripletsLEDState();
65
66 [[nodiscard]] int32_t getPosFromSquare(int32_t square, int32_t localScroll = -1) const;
67 [[nodiscard]] int32_t getPosFromSquare(int32_t square, int32_t xScroll, uint32_t xZoom) const;
68 int32_t getSquareFromPos(int32_t pos, bool* rightOnSquare = nullptr, int32_t localScroll = -1);
69 int32_t getSquareFromPos(int32_t pos, bool* rightOnSquare, int32_t xScroll, uint32_t xZoom);
70 int32_t getSquareEndFromPos(int32_t pos, int32_t localScroll = -1);
71 bool isSquareDefined(int32_t square, int32_t xScroll = -1);
72 bool isSquareDefined(int32_t square, int32_t xScroll, uint32_t xZoom);
73
74 [[nodiscard]] bool inTripletsView() const;
75
76private:
82};
Definition instrument_clip.h:48
Definition note_row.h:99
uint32_t delayHorizontalZoomUntil
Used when scrolling horizontally to briefly catch on clip's max zoom.
Definition timeline_view.h:78
int8_t delayHorizontalZoomMagnitude
Definition timeline_view.h:81
TimelineView * toTimelineView() final
Convert this view to a TimelineView.
Definition timeline_view.h:33