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 e415165
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 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,13 @@ 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)) {
score()->select(cr->isChord() ? toChord(cr)->upNote() : cr);
}}}
}

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

0 comments on commit e415165

Please sign in to comment.