void Fermata::layout() { Segment* s = segment(); if (!s) { // for use in palette setPos(QPointF()); return; } qreal x = 0.0; Element* e = s->element(track()); if (e) { if (e->isChord()) x = score()->noteHeadWidth() * staff()->mag(0) * .5; else x = e->x() + e->width() * staff()->mag(0) * .5; } qreal y = placeAbove() ? styleP(Sid::fermataPosAbove) : styleP(Sid::fermataPosBelow) + staff()->height(); setPos(QPointF(x, y)); // check used symbol QString name = Sym::id2name(_symId); if (placeAbove()) { if (name.endsWith("Below")) _symId = Sym::name2id(name.left(name.size() - 5) + "Above"); } else { if (name.endsWith("Above")) _symId = Sym::name2id(name.left(name.size() - 5) + "Below"); } QRectF b(symBbox(_symId)); setbbox(b.translated(-0.5 * b.width(), 0.0)); autoplaceSegmentElement(styleP(Sid::fermataMinDistance)); }
void StaffTextBase::layout() { Staff* s = staff(); qreal y = placeAbove() ? styleP(Sid::staffTextPosAbove) : styleP(Sid::staffTextPosBelow) + (s ? s->height() : 0.0); setPos(QPointF(0.0, y)); TextBase::layout1(); autoplaceSegmentElement(styleP(Sid::staffTextMinDistance)); }
void Fermata::layout() { Segment* s = segment(); setPos(QPointF()); if (!s) { // for use in palette setOffset(0.0, 0.0); QRectF b(symBbox(_symId)); setbbox(b.translated(-0.5 * b.width(), 0.0)); return; } if (isStyled(Pid::OFFSET)) setOffset(propertyDefault(Pid::OFFSET).toPointF()); Element* e = s->element(track()); if (e) { if (e->isChord()) rxpos() += score()->noteHeadWidth() * staff()->mag(Fraction(0, 1)) * .5; else rxpos() += e->x() + e->width() * staff()->mag(Fraction(0, 1)) * .5; } QString name = Sym::id2name(_symId); if (placeAbove()) { if (name.endsWith("Below")) _symId = Sym::name2id(name.left(name.size() - 5) + "Above"); } else { rypos() += staff()->height(); if (name.endsWith("Above")) _symId = Sym::name2id(name.left(name.size() - 5) + "Below"); } QRectF b(symBbox(_symId)); setbbox(b.translated(-0.5 * b.width(), 0.0)); autoplaceSegmentElement(styleP(Sid::fermataMinDistance)); }
void TrillSegment::layout() { if (staff()) setMag(staff()->mag(tick())); if (isSingleType() || isBeginType()) { Accidental* a = trill()->accidental(); if (a) { a->layout(); a->setMag(a->mag() * .6); qreal _spatium = spatium(); a->setPos(_spatium * 1.3, -2.2 * _spatium); a->setParent(this); } switch (trill()->trillType()) { case Trill::Type::TRILL_LINE: symbolLine(SymId::ornamentTrill, SymId::wiggleTrill); break; case Trill::Type::PRALLPRALL_LINE: symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); break; case Trill::Type::UPPRALL_LINE: symbolLine(SymId::ornamentBottomLeftConcaveStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); break; case Trill::Type::DOWNPRALL_LINE: symbolLine(SymId::ornamentLeftVerticalStroke, SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd); break; } } else symbolLine(SymId::wiggleTrill, SymId::wiggleTrill); autoplaceSpannerSegment(styleP(Sid::trillMinDistance)); }
void TempoText::layout() { qreal y = placeAbove() ? styleP(Sid::tempoPosAbove) : styleP(Sid::tempoPosBelow) + staff()->height(); setPos(QPointF(0.0, y)); TextBase::layout1(); Segment* s = segment(); if (!s) // for use in palette return; // tempo text on first chordrest of measure should align over time sig if present // if (!s->rtick()) { Segment* p = segment()->prev(SegmentType::TimeSig); if (p) { rxpos() -= s->x() - p->x(); Element* e = p->element(staffIdx() * VOICES); if (e) rxpos() += e->x(); } } autoplaceSegmentElement(styleP(Sid::tempoMinDistance)); }
void InstrumentChange::layout() { TextBase::layout(); autoplaceSegmentElement(styleP(Sid::instrumentChangeMinDistance)); }