Skip to content

Commit

Permalink
Palette: Time Signatures applied will result in a valid ChordRest sel…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
worldwideweary committed Oct 3, 2024
1 parent 4218a44 commit 5a16cb2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ bool Score::rewriteMeasures(Measure* fm, const Fraction& ns, int staffIdx)

void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
{
auto el = score()->selection().firstChordRest();
auto selectTrack = el ? el->track() : 0;
auto selectTick = el ? el->tick() : Fraction(0,1);

deselectAll();

if (fm->isMMRest())
Expand Down Expand Up @@ -911,6 +915,17 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
}
}
delete ts;

// Attempt valid selection afterward:
if (el) {
if (auto msr = score()->tick2measure(selectTick)) {
if (auto first = msr->first()) {
if (auto cr = first->nextChordRest(selectTrack)) {
if (cr->isChord())
score()->select(toChord(cr)->upNote());
else
score()->select(cr);
}}}}
}

//---------------------------------------------------------
Expand Down

0 comments on commit 5a16cb2

Please sign in to comment.