Skip to content

Commit

Permalink
Manually merged #6100 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-os committed Aug 7, 2020
1 parent cfa6325 commit 6a8100d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion libmscore/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,7 @@ void Chord::layoutPitched()
lhead = qMax(lhead, -x1);

Accidental* accidental = note->accidental();
if (accidental && !note->fixed()) {
if (accidental && accidental->addToSkyline() && !note->fixed()) {
// convert x position of accidental to segment coordinate system
qreal x = accidental->pos().x() + note->pos().x() + chordX;
// distance from accidental to note already taken into account
Expand Down
64 changes: 35 additions & 29 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,37 +872,43 @@ void Score::layoutChords3(std::vector<Note*>& notes, const Staff* staff, Segment
Accidental* ac = note->accidental();
if (ac && !note->fixed()) {
ac->layout();
AcEl acel;
acel.note = note;
int line = note->line();
acel.line = line;
acel.x = 0.0;
acel.top = line * 0.5 * sp + ac->bbox().top();
acel.bottom = line * 0.5 * sp + ac->bbox().bottom();
acel.width = ac->width();
QPointF bboxNE = ac->symBbox(ac->symbol()).topRight();
QPointF bboxSW = ac->symBbox(ac->symbol()).bottomLeft();
QPointF cutOutNE = ac->symCutOutNE(ac->symbol());
QPointF cutOutSW = ac->symCutOutSW(ac->symbol());
if (!cutOutNE.isNull()) {
acel.ascent = cutOutNE.y() - bboxNE.y();
acel.rightClear = bboxNE.x() - cutOutNE.x();
if (!ac->visible()) {
ac->setPos(ac->bbox().x() - ac->width(), 0.0);
} else {
acel.ascent = 0.0;
acel.rightClear = 0.0;
AcEl acel;
acel.note = note;
int line = note->line();
acel.line = line;
acel.x = 0.0;
acel.top = line * 0.5 * sp + ac->bbox().top();
acel.bottom = line * 0.5 * sp + ac->bbox().bottom();
acel.width = ac->width();
QPointF bboxNE = ac->symBbox(ac->symbol()).topRight();
QPointF bboxSW = ac->symBbox(ac->symbol()).bottomLeft();
QPointF cutOutNE = ac->symCutOutNE(ac->symbol());
QPointF cutOutSW = ac->symCutOutSW(ac->symbol());
if (!cutOutNE.isNull()) {
acel.ascent = cutOutNE.y() - bboxNE.y();
acel.rightClear = bboxNE.x() - cutOutNE.x();
} else {
acel.ascent = 0.0;
acel.rightClear = 0.0;
}

if (!cutOutSW.isNull()) {
acel.descent = bboxSW.y() - cutOutSW.y();
acel.leftClear = cutOutSW.x() - bboxSW.x();
} else {
acel.descent = 0.0;
acel.leftClear = 0.0;
}

int pitchClass = (line + 700) % 7;
acel.next = columnBottom[pitchClass];
columnBottom[pitchClass] = nAcc;
aclist.append(acel);
++nAcc;
}
if (!cutOutSW.isNull()) {
acel.descent = bboxSW.y() - cutOutSW.y();
acel.leftClear = cutOutSW.x() - bboxSW.x();
} else {
acel.descent = 0.0;
acel.leftClear = 0.0;
}
int pitchClass = (line + 700) % 7;
acel.next = columnBottom[pitchClass];
columnBottom[pitchClass] = nAcc;
aclist.append(acel);
++nAcc;
}

Chord* chord = note->chord();
Expand Down
2 changes: 1 addition & 1 deletion libmscore/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4363,7 +4363,7 @@ static bool hasAccidental(Segment* s)
}
Chord* c = toChord(e);
for (Note* n : c->notes()) {
if (n->accidental()) {
if (n->accidental() && n->accidental()->addToSkyline()) {
return true;
}
}
Expand Down
8 changes: 4 additions & 4 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3660,11 +3660,11 @@ Shape Note::shape() const
for (NoteDot* dot : _dots) {
shape.add(symBbox(SymId::augmentationDot).translated(dot->pos()), dot->name());
}
if (_accidental) {
if (_accidental && _accidental->addToSkyline()) {
shape.add(_accidental->bbox().translated(_accidental->pos()), _accidental->name());
}
for (auto e : _el) {
if (e->autoplace() && e->visible()) {
if (e->addToSkyline()) {
if (e->isFingering() && toFingering(e)->layoutType() != ElementType::NOTE) {
continue;
}
Expand All @@ -3676,11 +3676,11 @@ Shape Note::shape() const
for (NoteDot* dot : _dots) {
shape.add(symBbox(SymId::augmentationDot).translated(dot->pos()));
}
if (_accidental) {
if (_accidental && _accidental->addToSkyline()) {
shape.add(_accidental->bbox().translated(_accidental->pos()));
}
for (auto e : _el) {
if (e->autoplace() && e->visible()) {
if (e->addToSkyline()) {
if (e->isFingering() && toFingering(e)->layoutType() != ElementType::NOTE) {
continue;
}
Expand Down

0 comments on commit 6a8100d

Please sign in to comment.