Merge pull request #1575 from MarcSabatella/42031-slur-articulation-flip

fix #42031: slur position relative to flipped articulation
This commit is contained in:
Werner Schweer 2015-01-02 09:19:28 +01:00
commit ed7dbedb7b
8 changed files with 19 additions and 9 deletions

View file

@ -2552,6 +2552,7 @@ QPointF Chord::layoutArticulation(Articulation* a)
// TENUTO and STACCATO: always near the note head (or stem end if beyond a stem)
if ((st == ArticulationType::Tenuto || st == ArticulationType::Staccato || st == ArticulationType::Sforzatoaccent) && (aa != ArticulationAnchor::TOP_STAFF && aa != ArticulationAnchor::BOTTOM_STAFF)) {
bool bottom; // true: artic. is below chord | false: artic. is above chord
bool alignToStem = false;
// if there area voices, articulation is on stem side
if ((aa == ArticulationAnchor::CHORD) && measure()->hasVoices(a->staffIdx()))
bottom = !up();
@ -2582,6 +2583,7 @@ QPointF Chord::layoutArticulation(Articulation* a)
qreal dy = (score()->styleS(StyleIdx::beamWidth).val() + 1) * _spatium2;
pos.ry() += bottom ? dy : - dy;
}
alignToStem = (st == ArticulationType::Staccato && articulations().size() == 1);
}
else { // if articulation is not beyond a stem
int line;
@ -2607,7 +2609,7 @@ QPointF Chord::layoutArticulation(Articulation* a)
}
pos.ry() += line * _spStaff2; // convert staff position to sp distance
}
if (!staff()->isTabStaff()) {
if (!staff()->isTabStaff() && !alignToStem) {
if (up())
pos.rx() -= upNote()->headWidth() * .5; // move half-a-note-head to left
else

View file

@ -604,7 +604,9 @@ void ChordRest::layoutArticulations()
y = chordTopY + stem->stemLen();
if (chord->beam())
y += score()->styleS(StyleIdx::beamWidth).val() * _spatium * .5;
x = stem->pos().x();
// aligning horizontally to stem makes sense only for staccato
// and only if no other articulations on this side
//x = stem->pos().x();
int line = lrint((y+0.5*_spatium) / _spatium);
if (line <= 4) // align between staff lines
y = line * _spatium + _spatium * .5;
@ -628,7 +630,9 @@ void ChordRest::layoutArticulations()
y = chordBotY + stem->stemLen();
if (chord->beam())
y -= score()->styleS(StyleIdx::beamWidth).val() * _spatium * .5;
x = stem->pos().x();
// aligning horizontally to stem makes sense only for staccato
// and only if no other articulations on this side
//x = stem->pos().x();
int line = lrint((y-0.5*_spatium) / _spatium);
if (line >= 0) // align between staff lines
y = line * _spatium - _spatium * .5;

View file

@ -1370,7 +1370,7 @@ void Score::cmdFlip()
MScore::Direction d = a->up() ? MScore::Direction::DOWN : MScore::Direction::UP;
undoChangeProperty(a, P_ID::DIRECTION, int(d));
}
return; // no layoutAll
//return; // no layoutAll
}
else if (e->type() == Element::Type::TUPLET) {
Tuplet* tuplet = static_cast<Tuplet*>(e);
@ -1393,7 +1393,7 @@ void Score::cmdFlip()
undoChangeProperty(e, P_ID::PLACEMENT, int(p));
}
}
_layoutAll = true; // must be set in und/redo
_layoutAll = true; // must be set in undo/redo
}
//---------------------------------------------------------

View file

@ -717,12 +717,16 @@ static qreal fixArticulations(qreal yo, Chord* c, qreal _up)
const QList<Articulation*>& al = c->articulations();
if (al.size() >= 2) {
Articulation* a = al.at(1);
if (a->articulationType() == ArticulationType::Tenuto || a->articulationType() == ArticulationType::Staccato)
if (a->up() == c->up())
return yo;
else if (a->articulationType() == ArticulationType::Tenuto || a->articulationType() == ArticulationType::Staccato)
return a->y() + (a->height() + c->score()->spatium() * .3) * _up;
}
else if (al.size() >= 1) {
Articulation* a = al.at(0);
if (a->articulationType() == ArticulationType::Tenuto || a->articulationType() == ArticulationType::Staccato)
if (a->up() == c->up())
return yo;
else if (a->articulationType() == ArticulationType::Tenuto || a->articulationType() == ArticulationType::Staccato)
return a->y() + (a->height() + c->score()->spatium() * .3) * _up;
}
return yo;

View file

@ -38,7 +38,7 @@ else
emmentaler-text-1 gonville-text-1 bravura-text-1 musejazz-text-1\
emmentaler-text-2 gonville-text-2 bravura-text-2 musejazz-text-2\
emmentaler-text-3 gonville-text-3 bravura-text-3 musejazz-text-3\
frametext ottava slurs-1 slurs-2 hairpins-1 pedal-1 line-1 line-2 line-3 line-4 gliss-1 gliss-2\
frametext ottava slurs-1 slurs-2 slurs-3 hairpins-1 pedal-1 line-1 line-2 line-3 line-4 gliss-1 gliss-2\
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 cross-1\

View file

@ -13,7 +13,7 @@ set SRC=mmrest-1,bravura-mmrest,gonville-mmrest,mmrest-2,mmrest-4,mmrest-5,mmres
emmentaler-text-1,gonville-text-1,bravura-text-1,musejazz-text-1, ^
emmentaler-text-2,gonville-text-2,bravura-text-2,musejazz-text-2, ^
emmentaler-text-3,gonville-text-3,bravura-text-3,musejazz-text-3, ^
frametext,ottava,slurs-1,slurs-2,hairpins-1,pedal-1,line-1,line-2,line-3,line-4,gliss-1,gliss-2, ^
frametext,ottava,slurs-1,slurs-2,slurs-3,hairpins-1,pedal-1,line-1,line-2,line-3,line-4,gliss-1,gliss-2, ^
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,cross-1, ^

BIN
vtest/slurs-3-ref.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
vtest/slurs-3.mscz Normal file

Binary file not shown.