Skip to content

Commit

Permalink
fix #40581: overlapping ledger lines between voices
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Dec 3, 2014
1 parent 28b5daf commit 5d32967
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
26 changes: 24 additions & 2 deletions libmscore/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1902,8 +1902,30 @@ void Chord::layoutPitched()
else if (rtick()) {
// if this is not first chord of measure, get previous chord
Segment* s = segment()->prev(Segment::Type::ChordRest);
if (s && s->element(track()) && s->element(track())->type() == Element::Type::CHORD)
pc = static_cast<Chord*>(s->element(track()));
if (s) {
// prefer chord in same voice
// but if nothing there, look at other voices
// note this still leaves the possibility
// that this voice does not have conflict but another voice does
Element* e = s->element(track());
if (e && e->type() == Element::Type::CHORD)
pc = static_cast<Chord*>(e);
else {
int startTrack = staffIdx() * VOICES;
int endTrack = startTrack + VOICES;
for (int t = startTrack; t < endTrack; ++t) {
if (t == track()) // already checked current voice
continue;
e = s->element(t);
if (e && e->type() == Element::Type::CHORD) {
pc = static_cast<Chord*>(e);
// prefer chord with ledger lines
if (pc->ledgerLines())
break;
}
}
}
}
}
if (pc && !pc->graceNotes().isEmpty()) {
// if previous chord has grace notes after, find last one
Expand Down
Binary file added vtest/chord-space-2-ref.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vtest/chord-space-2.mscz
Binary file not shown.
2 changes: 1 addition & 1 deletion vtest/gen
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else
accidental-6 accidental-7 accidental-8 accidental-9\
tie-1 tie-2 tie-3 grace-1 grace-2 grace-3 grace-4 harmony-1 harmony-2 harmony-3 harmony-4 harmony-5\
beams-1 beams-2 beams-3 beams-4 beams-5 beams-6 beams-7\
user-offset-1 user-offset-2 chord-space-1 tablature-1 image-1\
user-offset-1 user-offset-2 chord-space-1 chord-space-2 tablature-1 image-1\
lyrics-1 lyrics-2 lyrics-3 voice-1 slash-1 slash-2"
fi

Expand Down
2 changes: 1 addition & 1 deletion vtest/gen.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set SRC=mmrest-1,bravura-mmrest,gonville-mmrest,mmrest-2,mmrest-4,mmrest-5,mmres
accidental-6,accidental-7,accidental-8,accidental-9, ^
tie-1,tie-2,tie-3,grace-1,grace-2,grace-3,grace-4,harmony-1,harmony-2,harmony-3,harmony-4,harmony-5, ^
beams-1,beams-2,beams-3,beams-4,beams-5,beams-6,beams-7, ^
user-offset-1,user-offset-2,chord-space-1,tablature-1,image-1, ^
user-offset-1,user-offset-2,chord-space-1,chord-space-2,tablature-1,image-1, ^
lyrics-1,lyrics-2,lyrics-3,voice-1,slash-1,slash-2

set MSCORE=..\win32install\bin\mscore.exe
Expand Down

0 comments on commit 5d32967

Please sign in to comment.