Esempio n. 1
0
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));
      }
Esempio n. 2
0
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));
      }
Esempio n. 3
0
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));
      }
Esempio n. 4
0
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));
      }
Esempio n. 5
0
void InstrumentChange::layout()
      {
      TextBase::layout();
      autoplaceSegmentElement(styleP(Sid::instrumentChangeMinDistance));
      }