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 2d7993b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 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)
{
if (!score()->selection().firstChordRest())
return;
auto selectTrack = score()->selection().firstChordRest()->track();
auto selectTick = score()->selection().firstChordRest()->tick();
deselectAll();

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

// Attempt valid selection afterward:
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 2d7993b

Please sign in to comment.