Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_clip_canvas_renderer.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <vector>
7
8#include "dsp/tick_types.h"
9
10#include <QColor>
11#include <QString>
12#include <QtCanvasPainter/qcanvaspainter.h>
13#include <QtCanvasPainter/qcanvaspainteritemrenderer.h>
14
15namespace zrythm::structure::arrangement
16{
17class ChordClip;
18class ChordObject;
19}
20
21namespace zrythm::gui::qquick
22{
23
29{
31 dsp::ContentTick abs_start{};
33 dsp::ContentTick abs_end{};
37 int chord_index = 0;
38};
39
47std::vector<ComputedChordCell>
48compute_chord_cells (
50 dsp::ContentTick display_end_tick);
51
56class ChordClipCanvasRenderer : public QCanvasPainterItemRenderer
57{
58public:
59 ChordClipCanvasRenderer () = default;
60 Q_DISABLE_COPY_MOVE (ChordClipCanvasRenderer)
61
62 void synchronize (QCanvasPainterItem * item) override;
63 void paint (QCanvasPainter * painter) override;
64
65private:
66 struct CachedCell
67 {
68 float x;
69 float width;
70 QString full_name;
71 QString root_note;
72 float full_name_width;
73 QColor bg_color;
74 bool muted;
75 };
76
77 std::vector<CachedCell> cells_;
78 QColor text_color_;
79 QFont font_;
80 QFont bold_font_;
81 float canvas_width_ = 0.0f;
82 float canvas_height_ = 0.0f;
83};
84
85} // namespace zrythm::gui::qquick
A chord placed inside a ChordClip on the chord track.
One chord as it should be drawn within the clip, after loop expansion.
dsp::ContentTick abs_end
Absolute end position within the clip.
dsp::ContentTick abs_start
Absolute start position within the clip.
int chord_index
Index of the chord in insertion order (not sorted order).
structure::arrangement::ChordObject * chord_object
Pointer to the source chord object.