Allow cutting multiple notes at once in Piano Roll (#7715)

Adds the ability to cut multiple notes at once in the Piano Roll. Users can select the Knife tool and create a cut line by holding the mouse and dragging it across the notes that should be cut. This also allows cutting the notes at an angle. When releasing the mouse, the Shift key can be pressed to remove the shorter end of the notes that were cut. If any notes are selected, only they will be considered for the cut, even if the cut line covers more notes.
This commit is contained in:
regulus79
2025-03-02 18:29:29 -05:00
committed by GitHub
parent 5fa01e7dbc
commit c12fd571f5
4 changed files with 85 additions and 47 deletions

View File

@@ -82,6 +82,9 @@ public:
// Split the list of notes on the given position
void splitNotes(const NoteVector& notes, TimePos pos);
// Split the list of notes along a line
void splitNotesAlongLine(const NoteVector notes, TimePos pos1, int key1, TimePos pos2, int key2, bool deleteShortEnds);
// clip-type stuff
inline Type type() const
{

View File

@@ -456,9 +456,14 @@ private:
// did we start a mouseclick with shift pressed
bool m_startedWithShift;
// Variable that holds the position in ticks for the knife action
int m_knifeTickPos;
void updateKnifePos(QMouseEvent* me);
// Variables that hold the start and end position for the knife line
TimePos m_knifeStartTickPos;
int m_knifeStartKey;
TimePos m_knifeEndTickPos;
int m_knifeEndKey;
bool m_knifeDown;
void updateKnifePos(QMouseEvent* me, bool initial);
friend class PianoRollWindow;