Deluge Firmware 1.3.0
Build date: 2025.04.16
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 virtual void tellMatrixDriverWhichRowsContainSomethingZoomable() {
43 } // SessionView doesn't have this because it does this a different way. Sorry, confusing I know
44
45 ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) override;
46 void displayZoomLevel(bool justPopup = false);
47 ActionResult horizontalEncoderAction(int32_t offset) override;
48 void displayScrollPos();
49 void displayNumberOfBarsAndBeats(uint32_t number, uint32_t quantization, bool countFromOne,
50 char const* tooLongText);
51 void initiateXScroll(uint32_t newXScroll, int32_t numSquaresToScroll = kDisplayWidth);
52 bool zoomToMax(bool inOnly = false);
53 void initiateXZoom(int32_t zoomMagnitude, int32_t newScroll, uint32_t oldZoom);
54 void midiLearnFlash() override;
55
56 bool scrollRightToEndOfLengthIfNecessary(int32_t maxLength);
57
58 bool scrollLeftIfTooFarRight(int32_t maxLength);
59
60 void tripletsButtonPressed();
61 void setTripletsLEDState();
62
63 [[nodiscard]] int32_t getPosFromSquare(int32_t square, int32_t localScroll = -1) const;
64 [[nodiscard]] int32_t getPosFromSquare(int32_t square, int32_t xScroll, uint32_t xZoom) const;
65 int32_t getSquareFromPos(int32_t pos, bool* rightOnSquare = nullptr, int32_t localScroll = -1);
66 int32_t getSquareFromPos(int32_t pos, bool* rightOnSquare, int32_t xScroll, uint32_t xZoom);
67 int32_t getSquareEndFromPos(int32_t pos, int32_t localScroll = -1);
68 bool isSquareDefined(int32_t square, int32_t xScroll = -1);
69 bool isSquareDefined(int32_t square, int32_t xScroll, uint32_t xZoom);
70
71 [[nodiscard]] bool inTripletsView() const;
72
73private:
79};
Definition instrument_clip.h:48
Definition note_row.h:98
uint32_t delayHorizontalZoomUntil
Used when scrolling horizontally to briefly catch on clip's max zoom.
Definition timeline_view.h:75
int8_t delayHorizontalZoomMagnitude
Definition timeline_view.h:78
TimelineView * toTimelineView() final
Convert this view to a TimelineView.
Definition timeline_view.h:33