From 1ca7a831c2a3d63611785946abc25042883559f8 Mon Sep 17 00:00:00 2001 From: Kenny Cho Date: Sun, 25 Aug 2024 13:39:13 +0100 Subject: [PATCH 1/2] Restore clef/timesig/keysig at end of selection not start --- src/notation/internal/notationinteraction.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/notation/internal/notationinteraction.cpp b/src/notation/internal/notationinteraction.cpp index 1ec1c53defa16..f588c8b77fce5 100644 --- a/src/notation/internal/notationinteraction.cpp +++ b/src/notation/internal/notationinteraction.cpp @@ -1847,22 +1847,22 @@ bool NotationInteraction::applyPaletteElement(mu::engraving::EngravingItem* elem } } if (m2 || e2) { - // restore original clef/keysig/timesig + // restore clef/keysig/timesig that was in effect at end of selection mu::engraving::Staff* staff = score->staff(i); - mu::engraving::Fraction tick1 = sel.startSegment()->tick(); + mu::engraving::Fraction tick2 = sel.endSegment()->tick(); mu::engraving::EngravingItem* oelement = nullptr; switch (element->type()) { case mu::engraving::ElementType::CLEF: { mu::engraving::Clef* oclef = engraving::Factory::createClef(score->dummy()->segment()); - oclef->setClefType(staff->clef(tick1)); + oclef->setClefType(staff->clef(tick2)); oelement = oclef; break; } case mu::engraving::ElementType::KEYSIG: { mu::engraving::KeySig* okeysig = engraving::Factory::createKeySig(score->dummy()->segment()); - okeysig->setKeySigEvent(staff->keySigEvent(tick1)); + okeysig->setKeySigEvent(staff->keySigEvent(tick2)); Key ck = okeysig->concertKey(); okeysig->setKey(ck); oelement = okeysig; @@ -1871,7 +1871,7 @@ bool NotationInteraction::applyPaletteElement(mu::engraving::EngravingItem* elem case mu::engraving::ElementType::TIMESIG: { mu::engraving::TimeSig* otimesig = engraving::Factory::createTimeSig(score->dummy()->segment()); - otimesig->setFrom(staff->timeSig(tick1)); + otimesig->setFrom(staff->timeSig(tick2)); oelement = otimesig; break; } From a9ce85731fb6506614abedd7c9907b81f9453817 Mon Sep 17 00:00:00 2001 From: Kenny Cho Date: Mon, 26 Aug 2024 15:50:03 +0100 Subject: [PATCH 2/2] Fix #17718: actually check if previous measure is MMRest --- src/engraving/dom/select.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engraving/dom/select.cpp b/src/engraving/dom/select.cpp index 1ef35cd3c01cb..0cbc0df106ada 100644 --- a/src/engraving/dom/select.cpp +++ b/src/engraving/dom/select.cpp @@ -610,9 +610,12 @@ void Selection::updateSelectedElements() return; } - if (s2 && s2 == s2->measure()->first() && !(s2->measure()->prevMeasure() && s2->measure()->prevMeasure()->coveringMMRestOrThis())) { + if (s2 && s2 == s2->measure()->first()) { // we want the last segment of the previous measure (unless it's part of a MMrest) - s2 = s2->prev1(); + Measure* prevMeasure = s2->measure()->prevMeasure(); + if (!(prevMeasure && prevMeasure != prevMeasure->coveringMMRestOrThis())) { + s2 = s2->prev1(); + } } setRange(s1, s2, staffStart, staffEnd);