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(); }
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); } }
void TrillSegment::remove(Element* e) { if (trill()->accidental() == e) { // accidental is part of trill trill()->setAccidental(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; } } } }
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); }
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)); } }
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(); }
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); } }
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); } }
QVariant TrillSegment::propertyDefault(P_ID id) const { switch (id) { case P_ID::TRILL_TYPE: return trill()->propertyDefault(id); default: return LineSegment::propertyDefault(id); } }
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); } }
QVariant TrillSegment::getProperty(P_ID id) const { switch (id) { case P_TRILL_TYPE: return trill()->getProperty(id); default: return LineSegment::getProperty(id); } }
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); } }
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); } }
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); } }
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; }
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; }
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(); }
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); } }
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); } }
void TrillSegment::draw(QPainter* painter) const { painter->setPen(curColor(trill())); drawSymbols(_symbols, painter); }
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); } }