예제 #1
0
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();
      }
예제 #2
0
파일: trill.cpp 프로젝트: SSMN/MuseScore
void TrillSegment::draw(Painter* painter) const
      {
      qreal mag = magS();
      int idx    = score()->symIdx();
      qreal w2   = symbols[idx][trillelementSym].width(mag);
      QRectF b2(symbols[idx][trillelementSym].bbox(mag));

      if (spannerSegmentType() == SEGMENT_SINGLE || spannerSegmentType() == SEGMENT_BEGIN) {
            QRectF b1(symbols[idx][trillSym].bbox(mag));
            QRectF b2(symbols[idx][trillelementSym].bbox(mag));

            qreal x0   = -b1.x();
            qreal x1   = x0 + b1.width();
            qreal x2   = pos2().x();
            int n      = int(floor((x2-x1) / w2));

            symbols[idx][trillSym].draw(painter, mag, x0, 0.0);
            symbols[idx][trillelementSym].draw(painter, mag,  x1, b2.y() * .9, n);

            if (trill()->accidental()) {
                  painter->save();
                  painter->translate(trill()->accidental()->pagePos());
                  trill()->accidental()->draw(painter);
                  painter->restore();
                  }
            }
      else {
            qreal x1 = 0.0;
            qreal x2 = pos2().x();
            int n = int(floor((x2-x1) / w2));
            symbols[idx][trillelementSym].draw(painter, mag,  x1, b2.y() * .9, n);
            }
      }
예제 #3
0
void TrillSegment::remove(Element* e)
      {
      if (trill()->accidental() == e) {
            // accidental is part of trill
            trill()->setAccidental(0);
            }
      }
예제 #4
0
void TrillSegment::layout()
      {
      if (autoplace())
            setUserOff(QPointF());

      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);

      if (parent()) {
            qreal yo = score()->styleP(trill()->placeBelow() ? Sid::trillPosBelow : Sid::trillPosAbove);
            rypos() = yo;
            if (autoplace()) {
                  qreal minDistance = spatium();
                  Shape s1 = shape().translated(pos());
                  if (trill()->placeAbove()) {
                        qreal d  = system()->topDistance(staffIdx(), s1);
                        if (d > -minDistance)
                              rUserYoffset() = -d - minDistance;
                        }
                  else {
                        qreal d  = system()->bottomDistance(staffIdx(), s1);
                        if (d > -minDistance)
                              rUserYoffset() = d + minDistance;
                        }
                  }
            }
      }
예제 #5
0
void TrillSegment::layout()
      {
      QRectF b1(symbols[score()->symIdx()][trillSym].bbox(magS()));
      QRectF rr(b1.translated(-b1.x(), 0.0));
      rr |= QRectF(0.0, rr.y(), pos2().x(), rr.height());
      if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_BEGIN) {
            if (trill()->accidental()) {
                  rr |= trill()->accidental()->bbox().translated(trill()->accidental()->pos());
                  }
            }
      setbbox(rr);
      }
예제 #6
0
void TrillSegment::add(Element* e)
      {
      e->setParent(this);
      if (e->type() == Element::Type::ACCIDENTAL) {
            // accidental is part of trill
            trill()->setAccidental(static_cast<Accidental*>(e));
            }
      }
예제 #7
0
void TrillSegment::layout()
{
    if (parent())
        rypos() += score()->styleS(StyleIdx::trillY).val() * spatium();
    if (staff())
        setMag(staff()->mag());
    if (spannerSegmentType() == SpannerSegmentType::SINGLE || spannerSegmentType() == SpannerSegmentType::BEGIN) {
        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->adjustReadPos();
        }
        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:
            if (score()->scoreFont()->isValid(SymId::ornamentBottomLeftConcaveStroke))
                symbolLine(SymId::ornamentBottomLeftConcaveStroke,
                           SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd);
            else
                symbolLine(SymId::ornamentUpPrall,
                           // SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd);
                           SymId::ornamentZigZagLineNoRightEnd);
            break;
        case Trill::Type::DOWNPRALL_LINE:
            if (score()->scoreFont()->isValid(SymId::ornamentLeftVerticalStroke))
                symbolLine(SymId::ornamentLeftVerticalStroke,
                           SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd);
            else
                symbolLine(SymId::ornamentDownPrall,
                           // SymId::ornamentZigZagLineNoRightEnd, SymId::ornamentZigZagLineWithRightEnd);
                           SymId::ornamentZigZagLineNoRightEnd);
            break;
        }
    }
    else
        symbolLine(SymId::wiggleTrill, SymId::wiggleTrill);
    adjustReadPos();
}
예제 #8
0
void TrillSegment::scanElements(void* data, void (*func)(void*, Element*), bool /*all*/)
      {
      func(data, this);
      if (isSingleType() || isBeginType()) {
            Accidental* a = trill()->accidental();
            if (a)
                  func(data, a);
            }
      }
예제 #9
0
bool TrillSegment::setProperty(P_ID id, const QVariant& v)
      {
      switch (id) {
            case P_ID::TRILL_TYPE:
                  return trill()->setProperty(id, v);
            default:
                  return LineSegment::setProperty(id, v);
            }
      }
예제 #10
0
QVariant TrillSegment::propertyDefault(P_ID id) const
      {
      switch (id) {
            case P_ID::TRILL_TYPE:
                  return trill()->propertyDefault(id);
            default:
                  return LineSegment::propertyDefault(id);
            }
      }
예제 #11
0
void TrillSegment::scanElements(void* data, void (*func)(void*, Element*), bool /*all*/)
      {
      func(data, this);
      if (spannerSegmentType() == SpannerSegmentType::SINGLE || spannerSegmentType() == SpannerSegmentType::BEGIN) {
            Accidental* a = trill()->accidental();
            if (a)
                  func(data, a);
            }
      }
예제 #12
0
파일: trill.cpp 프로젝트: 33akash/MuseScore
QVariant TrillSegment::getProperty(P_ID id) const
      {
      switch (id) {
            case P_TRILL_TYPE:
                  return trill()->getProperty(id);
            default:
                  return LineSegment::getProperty(id);
            }
      }
예제 #13
0
QVariant TrillSegment::getProperty(P_ID id) const
{
    switch (id) {
    case P_ID::TRILL_TYPE:
    case P_ID::ORNAMENT_STYLE:
    case P_ID::PLAY:
        return trill()->getProperty(id);
    default:
        return LineSegment::getProperty(id);
    }
}
예제 #14
0
QVariant TrillSegment::propertyDefault(Pid id) const
      {
      switch (id) {
            case Pid::TRILL_TYPE:
            case Pid::ORNAMENT_STYLE:
            case Pid::PLACEMENT:
            case Pid::PLAY:
                  return trill()->propertyDefault(id);
            default:
                  return LineSegment::propertyDefault(id);
            }
      }
예제 #15
0
bool TrillSegment::setProperty(Pid id, const QVariant& v)
      {
      switch (id) {
            case Pid::TRILL_TYPE:
            case Pid::ORNAMENT_STYLE:
            case Pid::PLACEMENT:
            case Pid::PLAY:
                  return trill()->setProperty(id, v);
            default:
                  return LineSegment::setProperty(id, v);
            }
      }
예제 #16
0
파일: trill.cpp 프로젝트: SSMN/MuseScore
Element* TrillSegment::drop(const DropData& data)
      {
      Element* e = data.element;
      switch(e->type()) {
            case ACCIDENTAL:
                  e->setParent(trill());
                  score()->undoAddElement(e);
                  break;

            default:
                  delete e;
                  break;
            }
      return 0;
      }
예제 #17
0
Element* TrillSegment::drop(EditData& data)
      {
      Element* e = data.element;
      switch (e->type()) {
            case ElementType::ACCIDENTAL:
                  e->setParent(trill());
                  score()->undoAddElement(e);
                  break;

            default:
                  delete e;
                  e = 0;
                  break;
            }
      return e;
      }
예제 #18
0
파일: trill.cpp 프로젝트: Isensee/MuseScore
void TrillSegment::layout()
      {
      QRectF b1(symBbox(SymId::ornamentTrill));
      QRectF rr(b1.translated(-b1.x(), 0.0));
      rr |= QRectF(0.0, rr.y(), pos2().x(), rr.height());
      setbbox(rr);
      if (parent())
            rypos() += score()->styleS(ST_trillY).val() * spatium();
      if (spannerSegmentType() == SEGMENT_SINGLE || spannerSegmentType() == SEGMENT_BEGIN) {
            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->adjustReadPos();
                  }
            }
      adjustReadPos();
      }
예제 #19
0
파일: trill.cpp 프로젝트: bojan88/MuseScore
void TrillSegment::draw(QPainter* painter) const
      {
      qreal mag  = magS();
      int idx    = score()->symIdx();
      QRectF b2(symbols[idx][trillelementSym].bbox(mag));
      qreal w2   = symbols[idx][trillelementSym].width(mag);

      qreal x2   = pos2().x();

      painter->setPen(curColor());
      if (spannerSegmentType() == SEGMENT_SINGLE || spannerSegmentType() == SEGMENT_BEGIN) {
            int sym = 0;
            qreal x0 = 0.0, x1 = 0.0, y = 0.0;
            int n = 0;
            QRectF b1;

            switch(trill()->trillType()) {
                  case Trill::TRILL_LINE:
                        sym  = trillSym;
                        b1   = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = x0 + b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = 0.0;
                        break;

                  case Trill::UPPRALL_LINE:
                        sym  = upprallSym;
                        b1   = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case Trill::DOWNPRALL_LINE:
                        sym  = downprallSym;
                        b1   = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case Trill::PRALLPRALL_LINE:
                        sym  = prallprallSym;
                        b1   = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case Trill::PURE_LINE:
                        sym = noSym;
                        x0 = 0;
                        x1 = 0;
                        n    = int(floor((x2-x1) / w2));
                        y = 0.0;
                  }
            if (n <= 0)
                  n = 1;
            if (sym != noSym)
                  symbols[idx][sym].draw(painter, mag, QPointF(x0, y));
            symbols[idx][trillelementSym].draw(painter, mag,  QPointF(x1, b2.y() * .9), n);
            }
      else {
            qreal x1 = 0.0;
            int n = int(floor((x2-x1) / w2));
            symbols[idx][trillelementSym].draw(painter, mag,  QPointF(x1, b2.y() * .9), n);
            }
      }
예제 #20
0
파일: trill.cpp 프로젝트: Isensee/MuseScore
void TrillSegment::draw(QPainter* painter) const
      {
      QRectF b2(symBbox(SymId::wiggleTrill));
      qreal w2   = symWidth(SymId::wiggleTrill);

      qreal x2   = pos2().x();

      QColor color;
      if (flag(ELEMENT_DROP_TARGET))
            color = MScore::dropColor;
      else if (selected() && !(score() && score()->printing()))
            color = MScore::selectColor[0];
      else if (!visible())
            color = Qt::gray;
      else {
            color = trill()->curColor();
            }

      painter->setPen(color);
      if (spannerSegmentType() == SEGMENT_SINGLE || spannerSegmentType() == SEGMENT_BEGIN) {
            SymId sym = SymId::noSym;
            qreal x0 = 0.0, x1 = 0.0, y = 0.0;
            int n = 0;
            QRectF b1;

            switch(trill()->trillType()) {
                  case Trill::TRILL_LINE:
                        sym  = SymId::ornamentTrill;
                        b1   = symBbox(sym);
                        x0   = -b1.x();
                        x1   = x0 + b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = 0.0;
                        break;
#if 0 // TODO-smufl
                  case Trill::UPPRALL_LINE:
                        sym  = SymId(upprallSym);
                        b1   = score()->sym(sym).bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case Trill::DOWNPRALL_LINE:
                        sym  = SymId(downprallSym);
                        b1   = score()->sym(sym).bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case Trill::PRALLPRALL_LINE:
                        sym  = SymId(prallprallSym);
                        b1   = score()->sym(sym).bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
#endif
                  case Trill::PURE_LINE:
                        sym = SymId::noSym;
                        x0 = 0;
                        x1 = 0;
                        n    = int(floor((x2-x1) / w2));
                        y = 0.0;
                  }
            if (n <= 0)
                  n = 1;
            if (sym != SymId::noSym)
                  drawSymbol(sym, painter, QPointF(x0, y));
            drawSymbol(SymId::wiggleTrill, painter, QPointF(x1, b2.y() * .9), n);
            }
      else {
            qreal x1 = 0.0;
            int n = int(floor((x2-x1) / w2));
            drawSymbol(SymId::wiggleTrill, painter, QPointF(x1, b2.y() * .9), n);
            }
      }
예제 #21
0
파일: trill.cpp 프로젝트: 33akash/MuseScore
void TrillSegment::draw(QPainter* painter) const
      {
      painter->setPen(curColor(trill()));
      drawSymbols(_symbols, painter);
      }
예제 #22
0
void TrillSegment::draw(QPainter* painter) const
      {
      qreal mag  = magS();
      int idx    = score()->symIdx();
      QRectF b2(symbols[idx][trillelementSym].bbox(mag));
      qreal w2   = symbols[idx][trillelementSym].width(mag);

      qreal x2   = pos2().x();

      painter->setPen(curColor());
      if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_BEGIN) {
            int sym = 0;
            qreal x0 = 0.0, x1 = 0.0, y = 0.0;
            int n = 0;
            QRectF b1;

            switch(trill()->subtype()) {
                  case TRILL_LINE:
                        sym = trillSym;
                        b1  = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = x0 + b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = 0.0;
                        break;

                  case UPPRALL_LINE:
                        sym = upprallSym;
                        b1  = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case DOWNPRALL_LINE:
                        sym  = downprallSym;
                        b1   = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  case PRALLPRALL_LINE:
                        sym = prallprallSym;
                        b1  = symbols[idx][sym].bbox(mag);
                        x0   = -b1.x();
                        x1   = b1.width();
                        n    = int(floor((x2-x1) / w2));
                        y    = -b1.height();
                        break;
                  }
            if (n <= 0)
                  n = 1;

            symbols[idx][sym].draw(painter, mag, QPointF(x0, y));
            symbols[idx][trillelementSym].draw(painter, mag,  QPointF(x1, b2.y() * .9), n);

            if (trill()->accidental()) {
                  QPointF pos(trill()->accidental()->pagePos());
                  painter->translate(pos);
                  trill()->accidental()->draw(painter);
                  painter->translate(-pos);
                  }
            }
      else {
            qreal x1 = 0.0;
            int n = int(floor((x2-x1) / w2));
            symbols[idx][trillelementSym].draw(painter, mag,  QPointF(x1, b2.y() * .9), n);
            }
      }