Skip to content

Commit

Permalink
fix #29506: pedal line too short on single note
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Aug 21, 2014
1 parent aa7af8d commit 16db58b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
34 changes: 29 additions & 5 deletions libmscore/pedal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ QPointF Pedal::linePos(GripLine grip, System** sys) const
{
qreal x;
qreal nhw = score()->noteHeadWidth();
System* s;
System* s = nullptr;
if (grip == GripLine::START) {
ChordRest* c = static_cast<ChordRest*>(startElement());
s = c->segment()->system();
Expand All @@ -283,12 +283,36 @@ QPointF Pedal::linePos(GripLine grip, System** sys) const
x += nhw * .5;
}
else {
ChordRest* c = static_cast<ChordRest*>(endElement());
if (c) {
s = c->segment()->system();
x = c->pos().x() + c->segment()->pos().x() + c->segment()->measure()->pos().x();
ChordRest* c = nullptr;
Element* e = endElement();
if (!e || e == startElement()) {
// pedal marking on single note - extend to next note or end of measure
Segment* seg = startSegment();
if (seg) {
seg = seg->next();
for ( ; seg; seg = seg->next()) {
if (seg->segmentType() == Segment::Type::ChordRest) {
if (seg->element(track()))
break;
}
else if (seg->segmentType() == Segment::Type::EndBarLine) {
break;
}
}
}
if (seg) {
s = seg->system();
x = seg->pos().x() + seg->measure()->pos().x() - nhw * 2;
}
}
else {
c = static_cast<ChordRest*>(endElement());
if (c) {
s = c->segment()->system();
x = c->pos().x() + c->segment()->pos().x() + c->segment()->measure()->pos().x();
}
}
if (!s) {
int t = tick2();
Measure* m = score()->tick2measure(t);
s = m->system();
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
emmentaler-3 bravura-3 emmentaler-4 bravura-4 emmentaler-5 bravura-5\
emmentaler-6 bravura-6 emmentaler-7 bravura-7\
emmentaler-8 bravura-8 emmentaler-9 bravura-9 emmentaler-10 bravura-10\
emmentaler-11 bravura-11 frametext ottava slurs-1 slurs-2 hairpins-1\
emmentaler-11 bravura-11 frametext ottava slurs-1 slurs-2 hairpins-1 pedal-1\
chord-layout-1 chord-layout-2 chord-layout-3 chord-layout-4 chord-layout-5\
chord-layout-6 chord-layout-7 chord-layout-8 chord-layout-9 chord-layout-10\
chord-layout-11 chord-layout-12 chord-layout-13 chord-layout-14\
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set SRC=mmrest-1,bravura-mmrest,mmrest-2,mmrest-4,mmrest-5,mmrest-6,mmrest-7,mmr
emmentaler-3,bravura-3,emmentaler-4,bravura-4,emmentaler-5,bravura-5, ^
emmentaler-6,bravura-6,emmentaler-7,bravura-7, ^
emmentaler-8,bravura-8,emmentaler-9,bravura-9,emmentaler-10,bravura-10, ^
emmentlar-11,bravura-11,frametext,ottava,slurs-1,slurs-2,hairpins-1, ^
emmentlar-11,bravura-11,frametext,ottava,slurs-1,slurs-2,hairpins-1,pedal-1 ^
chord-layout-1,chord-layout-2,chord-layout-3,chord-layout-4,chord-layout-5, ^
chord-layout-6,chord-layout-7,chord-layout-8,chord-layout-9,chord-layout-10, ^
chord-layout-11,chord-layout-12,chord-layout-13,chord-layout-13, ^
Expand Down
Binary file added vtest/pedal-1-ref.png
Loading
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/pedal-1.mscz
Binary file not shown.

0 comments on commit 16db58b

Please sign in to comment.