Skip to content

Commit

Permalink
fix #63096: paste rehearsal mark
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella authored and lasconic committed Jun 8, 2015
1 parent 80cc88f commit 8d1fecf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion libmscore/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ Element* ChordRest::drop(const DropData& data)
//f->setTextStyleType(st);
if (st >= TextStyleType::DEFAULT && fromPalette)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), score()->textStyle(st));
if (e->type() == Element::Type::REHEARSAL_MARK)
if (e->type() == Element::Type::REHEARSAL_MARK && fromPalette)
t->setXmlText(score()->createRehearsalMarkText(static_cast<RehearsalMark*>(e)));
}
score()->undoAddElement(e);
Expand Down
27 changes: 16 additions & 11 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3817,17 +3817,22 @@ QString Score::createRehearsalMarkText(RehearsalMark* current) const
QString s2 = after ? after->xmlText() : "";
if (s1.isEmpty())
return s;
s = nextRehearsalMarkText(before, current); // try to sequence
if (!s2.isEmpty()) {
if (s != s2 && s != current->xmlText())
return s; // found something between before & after
else if (s1.size() == 2)
s = s1[0] + QChar::fromLatin1(s1[1].toLatin1() + 1); // B1 -> B2, BB -> BC, etc
else if (s1[0].isLetter())
s = s1 + QChar::fromLatin1('1'); // B -> B1, Bridge -> Bridge1, etc
}
else if (s == current->xmlText()) {
s = s1 + QChar::fromLatin1('1'); // B -> B1, Bridge -> Bridge1, etc
s = nextRehearsalMarkText(before, current); // try to sequence
if (s == current->xmlText()) {
// no sequence detected (or current happens to be correct)
return s;
}
else if (s == s2) {
// next in sequence already present
if (s1[0].isLetter()) {
if (s1.size() == 2)
s = s1[0] + QChar::fromLatin1(s1[1].toLatin1() + 1); // BB, BC, CC
else
s = s1 + QChar::fromLatin1('1'); // B, B1, C
}
else {
s = s1 + QChar::fromLatin1('A'); // 2, 2A, 3
}
}
return s;
}
Expand Down

0 comments on commit 8d1fecf

Please sign in to comment.