From 902a87257dd3b1e78effa0d5ef2a7b31e1963a87 Mon Sep 17 00:00:00 2001 From: SeeLook <seelook@gmail.com> Date: Sat, 30 Jan 2021 00:34:57 +0100 Subject: [PATCH] handle beaming after note was clicked - but its rhythm remains the same --- changes | 1 + src/libs/core/score/tscoreobject.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/changes b/changes index ca0f402e3..24bddda57 100644 --- a/changes +++ b/changes @@ -1,4 +1,5 @@ 1.7.4 git + - handle notes beaming of each piano staves separately - plenty of tiny user interface improvements and fixes BUG FIXES - no more jumping UI when some of them was pressed diff --git a/src/libs/core/score/tscoreobject.cpp b/src/libs/core/score/tscoreobject.cpp index 6dd143924..e038fe76f 100644 --- a/src/libs/core/score/tscoreobject.cpp +++ b/src/libs/core/score/tscoreobject.cpp @@ -125,10 +125,11 @@ void TscoreObject::setClefType(Tclef::EclefType ct) { && ((newNote.chromatic() < 8 && newNote.onUpperStaff()) || !newNote.onUpperStaff())) { // find when to fix beaming due to note went to/from grand staff newNote.setOnUpperStaff(false); - fixBeam = true; + if (newNote.rhythm() > Trhythm::Quarter) + fixBeam = true; } else if (pianoChanged && m_clefType != Tclef::PianoStaffClefs) { // or merge beams when note from the same rhythmic group where on different staves - if (!newNote.onUpperStaff()) + if (!newNote.onUpperStaff() && newNote.rhythm() > Trhythm::Quarter) fixBeam = true; } @@ -461,8 +462,20 @@ void TscoreObject::noteClicked(qreal yPos) { if (m_workRhythm->isRest() || m_clefType == Tclef::NoClef) newNote.setNote(0); + // when note changed staff upper/lower but rhythm is the same + // we have to resolve beaming and fit staff here, setNote() will not preform that + bool fixBeam = isPianoStaff() && newNote.rhythm() > Trhythm::Quarter + && m_activeNote && m_activeNote->note()->onUpperStaff() != newNote.onUpperStaff() + && newNote.isValid() && m_activeNote->note()->rtm == newRhythm; bool selectLastNoteAgain = m_activeNote == lastNote() && m_activeNote->note()->rtm != newRhythm; + setNote(m_activeNote, newNote); + + if (fixBeam) { + m_activeNote->measure()->resolveBeaming(m_activeNote->wrapper()->rhythmGroup(), m_activeNote->wrapper()->rhythmGroup()); + m_activeNote->staff()->fit(); + } + if (selectLastNoteAgain) { // clicked note is the last one and changed its rhythm, so it was deleted and added again m_activeNote = lastNote(); setSelectedItem(lastNote()); -- GitLab