Add Beat Preview to PatternClipView (#7559)

This PR changes the way PatternClips are drawn in include a simple "beat preivew," where each note in any non-empty instrument tracks within the pattern are drawn as short little rectangles on the ClipView. SampleClips and AutomationClips within patterns are not currently supported.

The height of the note boxes changes depending on how many tracks there are in the pattern, and how many of them actually have notes (empty tracks are only drawn half as tall).

There is also some padding at the top and bottom along with a little bit of spacing between each note, both vertically and horizontally. This can be edited in the css, along with the note color.

---------

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: Fawn <rubiefawn@gmail.com>
This commit is contained in:
regulus79
2025-12-02 17:34:50 -05:00
committed by GitHub
parent 58a4a8a909
commit 94f3b9704a
8 changed files with 102 additions and 13 deletions

View File

@@ -40,6 +40,11 @@ namespace gui
class PatternClipView : public ClipView
{
Q_OBJECT
Q_PROPERTY(float emptyTrackHeightRatio MEMBER m_emptyTrackHeightRatio)
Q_PROPERTY(float verticalPadding MEMBER m_verticalPadding)
Q_PROPERTY(float noteVerticalSpacing MEMBER m_noteVerticalSpacing)
Q_PROPERTY(float noteHorizontalSpacing MEMBER m_noteHorizontalSpacing)
Q_PROPERTY(QColor noteColor MEMBER m_noteColor)
public:
PatternClipView(Clip* clip, TrackView* tv);
~PatternClipView() override = default;
@@ -65,6 +70,12 @@ private:
QPixmap m_paintPixmap;
QStaticText m_staticTextName;
float m_emptyTrackHeightRatio {0.5f};
float m_verticalPadding {0.15f};
float m_noteVerticalSpacing {0.2f};
float m_noteHorizontalSpacing {0.2f};
QColor m_noteColor {255, 255, 255};
} ;

View File

@@ -99,6 +99,7 @@ public:
signals:
void trackAdded( lmms::Track * _track );
void trackRemoved();
protected:
static AutomatedValueMap automatedValuesFromTracks(const TrackList &tracks, TimePos timeStart, int clipNum = -1);