ported #7001 : fix #313420 [MusicXML] Instrument brackets are all imported at column 0

This commit is contained in:
Igor Korsukov 2021-02-17 13:12:17 +02:00 committed by pereverzev+v
parent bef81deede
commit 8282822076
2 changed files with 8 additions and 5 deletions

View file

@ -1088,10 +1088,9 @@ void MusicXMLParserPass1::scorePartwise()
// add bracket and set the span // add bracket and set the span
// TODO: use group-symbol default-x to determine horizontal order of brackets // TODO: use group-symbol default-x to determine horizontal order of brackets
Staff* staff = il.at(pg->start)->staff(0); Staff* staff = il.at(pg->start)->staff(0);
if (pg->type == BracketType::NO_BRACKET) { if (pg->type != BracketType::NO_BRACKET) {
staff->setBracketType(0, BracketType::NO_BRACKET); staff->setBracketType(pg->column, pg->type);
} else { staff->setBracketSpan(pg->column, stavesSpan);
staff->addBracket(new BracketItem(staff->score(), pg->type, stavesSpan));
} }
if (pg->barlineSpan) { if (pg->barlineSpan) {
staff->setBarLineSpan(pg->span); staff->setBarLineSpan(pg->span);
@ -1102,7 +1101,9 @@ void MusicXMLParserPass1::scorePartwise()
// multi-staff parts w/o explicit brackets get a brace // multi-staff parts w/o explicit brackets get a brace
foreach (Part const* const p, il) { foreach (Part const* const p, il) {
if (p->nstaves() > 1 && !partSet.contains(p)) { if (p->nstaves() > 1 && !partSet.contains(p)) {
p->staff(0)->addBracket(new BracketItem(p->score(), BracketType::BRACE, p->nstaves())); const int column = p->staff(0)->bracketLevels() + 1;
p->staff(0)->setBracketType(column, BracketType::BRACE);
p->staff(0)->setBracketSpan(column, p->nstaves());
if (allStaffGroupsIdentical(p)) { if (allStaffGroupsIdentical(p)) {
// span only if the same types // span only if the same types
p->staff(0)->setBarLineSpan(p->nstaves()); p->staff(0)->setBarLineSpan(p->nstaves());
@ -1737,6 +1738,7 @@ static void partGroupStart(MusicXmlPartGroupMap& pgs, int n, int p, QString s, b
pg->start = p; pg->start = p;
pg->barlineSpan = barlineSpan, pg->barlineSpan = barlineSpan,
pg->type = bracketType; pg->type = bracketType;
pg->column = n;
pgs[n] = pg; pgs[n] = pg;
} }

View file

@ -42,6 +42,7 @@ struct MusicXmlPartGroup {
int start; int start;
BracketType type; BracketType type;
bool barlineSpan; bool barlineSpan;
int column;
}; };
const int MAX_LYRICS = 16; const int MAX_LYRICS = 16;