This commit is contained in:
ws 2013-05-24 11:44:21 +02:00
parent b61faafe88
commit 9a8595b154
2 changed files with 35 additions and 51 deletions

View file

@ -1458,12 +1458,17 @@ void Chord::layoutPitch()
//-----------------------------------------
qreal stemX;
if (stem()) {
if (stem())
stem()->rypos() = (_up ? downNote() : upNote())->rypos();
stemX = stem()->pos().x();
if (_up) {
stemX = score()->noteHeadWidth();
if (_noteType != NOTE_NORMAL)
stemX *= score()->styleD(ST_graceNoteMag);
}
else
stemX = 0.0;
addLedgerLines(stemX, staffMove());
for (LedgerLine* ll = _ledgerLines; ll; ll = ll->next())
ll->layout();

View file

@ -140,7 +140,7 @@ void Tuplet::layout()
//
if (_direction == MScore::AUTO) {
int up = 1;
foreach(const DurationElement* e, _elements) {
foreach (const DurationElement* e, _elements) {
if (e->type() == CHORD) {
const Chord* c = static_cast<const Chord*>(e);
if (c->stemDirection() != MScore::AUTO)
@ -157,17 +157,6 @@ void Tuplet::layout()
else
_isUp = _direction == MScore::UP;
//
// set all elements to main direction
//
bool tupletContainsRest = false;
foreach(DurationElement* e, _elements) {
if (e->type() == REST) {
tupletContainsRest = true;
break;
}
}
const DurationElement* cr1 = _elements.front();
while (cr1->type() == TUPLET) {
const Tuplet* t = static_cast<const Tuplet*>(cr1);
@ -187,10 +176,9 @@ void Tuplet::layout()
// shall we draw a bracket?
//
if (_bracketType == AUTO_BRACKET) {
_hasBracket = tupletContainsRest;
if (!_hasBracket) {
foreach(DurationElement* e, _elements) {
if (e->type() == TUPLET) {
_hasBracket = false;
foreach (DurationElement* e, _elements) {
if (e->type() == TUPLET || e->type() == REST) {
_hasBracket = true;
break;
}
@ -206,7 +194,6 @@ void Tuplet::layout()
}
}
}
}
else
_hasBracket = _bracketType != SHOW_NO_BRACKET;
@ -214,22 +201,24 @@ void Tuplet::layout()
//
// calculate bracket start and end point p1 p2
//
qreal headDistance = _spatium * .75;
if (_isUp) {
p1 = cr1->abbox().topLeft();
p1.ry() -= headDistance;
p2 = cr2->abbox().topRight();
p2.ry() -= headDistance;
qreal headDistance = _spatium * .75;
if (_isUp)
headDistance = -headDistance;
p1 = cr1->pagePos();
p2 = cr2->pagePos();
p2.rx() += score()->noteHeadWidth();
p1.ry() += headDistance;
p2.ry() += headDistance;
if (_isUp) {
if (cr1->type() == CHORD) {
const Chord* chord1 = static_cast<const Chord*>(cr1);
Stem* stem = chord1->stem();
if (stem && chord1->up()) {
if (stem && chord1->up())
p1.setY(stem->abbox().y());
if (chord1->beam())
p1.setX(stem->abbox().x());
}
else if ((cr2->type() == CHORD) && stem && !chord1->up()) {
const Chord* chord2 = static_cast<const Chord*>(cr2);
Stem* stem2 = chord2->stem();
@ -244,11 +233,8 @@ void Tuplet::layout()
if (cr2->type() == CHORD) {
const Chord* chord2 = static_cast<const Chord*>(cr2);
Stem* stem = chord2->stem();
if (stem && chord2->up()) {
if (stem && chord2->up())
p2.setY(stem->abbox().top());
if (chord2->beam())
p2.setX(stem->abbox().x());
}
else if ((cr1->type() == CHORD) && stem && !chord2->up()) {
const Chord* chord1 = static_cast<const Chord*>(cr1);
int l1 = chord1->upNote()->line();
@ -299,16 +285,11 @@ void Tuplet::layout()
}
}
else {
p1 = cr1->abbox().bottomLeft();
p1.ry() += headDistance;
if (cr1->type() == CHORD) {
const Chord* chord1 = static_cast<const Chord*>(cr1);
Stem* stem = chord1->stem();
if (stem && !chord1->up()) {
p1.setY(stem->abbox().bottom());
if (chord1->beam())
p1.setX(stem->abbox().x());
}
else if ((cr2->type() == CHORD) && stem && chord1->up()) {
const Chord* chord2 = static_cast<const Chord*>(cr2);
@ -321,15 +302,13 @@ void Tuplet::layout()
}
}
p2 = cr2->abbox().bottomRight();
p2.ry() += headDistance;
if (cr2->type() == CHORD) {
const Chord* chord2 = static_cast<const Chord*>(cr2);
Stem* stem = chord2->stem();
if (stem && !chord2->up()) {
if (chord2->beam())
p2.setX(stem->abbox().x());
// if (chord2->beam())
// p2.setX(stem->abbox().x());
p2.setY(stem->abbox().bottom());
}
else if ((cr1->type() == CHORD) && stem && chord2->up()) {