void NoteGroups::noteClicked(Note* note) { Chord* chord = note->chord(); if (chord->beamMode() == Beam::Mode::AUTO) chord->setBeamMode(Beam::Mode::BEGIN); else if (chord->beamMode() == Beam::Mode::BEGIN) chord->setBeamMode(Beam::Mode::AUTO); chord->score()->doLayout(); view8->update(); view16->update(); view32->update(); }
Score* NoteGroups::createScore(int n, TDuration::DurationType t, std::vector<Chord*>* chords) { MCursor c; c.setTimeSig(_sig); c.createScore("score8"); c.addPart("voice"); c.move(0, 0); c.addKeySig(Key::C); TimeSig* nts = c.addTimeSig(_sig); GroupNode node {0, 0}; Groups ng; ng.push_back(node); nts->setGroups(ng); for (int i = 0; i < n; ++i) { Chord* chord = c.addChord(67, t); int tick = chord->rtick(); chord->setBeamMode(_groups.beamMode(tick, t)); chords->push_back(chord); } c.score()->pageFormat()->setEvenLeftMargin(0.0); c.score()->pageFormat()->setOddLeftMargin(0.0); c.score()->parts().front()->setLongName(""); c.score()->style().set(StyleIdx::linearStretch, 1.3); c.score()->style().set(StyleIdx::MusicalSymbolFont, QString("Bravura")); c.score()->style().set(StyleIdx::MusicalTextFont, QString("Bravura Text")); return c.score(); }
Score* NoteGroups::createScore(int n, TDuration::DurationType t, std::vector<Chord*>* chords) { MCursor c; c.setTimeSig(_sig); c.createScore("score8"); c.addPart("voice"); c.move(0, 0); c.addKeySig(0); TimeSig* nts = c.addTimeSig(_sig); GroupNode node {0, 0}; Groups ng; ng.push_back(node); nts->setGroups(ng); for (int i = 0; i < n; ++i) { Chord* chord = c.addChord(67, t); int tick = chord->rtick(); chord->setBeamMode(_groups.beamMode(tick, t)); chords->push_back(chord); } c.score()->parts().front()->setLongName(""); c.score()->style()->set(ST_linearStretch, 1.1); return c.score(); }
void ExampleView::dropEvent(QDropEvent* event) { QPointF pos(imatrix.map(QPointF(event->pos()))); if (!dragElement) return; if (dragElement->type() != ElementType::ICON) { delete dragElement; dragElement = 0; return; } foreach (Element* e, elementsAt(pos)) { if (e->type() == ElementType::NOTE) { Icon* icon = static_cast<Icon*>(dragElement); Chord* chord = static_cast<Note*>(e)->chord(); emit beamPropertyDropped(chord, icon); switch (icon->iconType()) { case IconType::SBEAM: chord->setBeamMode(Beam::Mode::BEGIN); break; case IconType::MBEAM: chord->setBeamMode(Beam::Mode::AUTO); break; case IconType::BEAM32: chord->setBeamMode(Beam::Mode::BEGIN32); break; case IconType::BEAM64: chord->setBeamMode(Beam::Mode::BEGIN64); break; default: break; } score()->doLayout(); break; } } event->acceptProposedAction(); delete dragElement; dragElement = 0; setDropTarget(0); }
void MsScWriter::note(const QString pitch, const QVector<Bww::BeamType> beamList, const QString type, const int dots, bool tieStart, bool /*TODO tieStop */, StartStop triplet, bool grace) { qDebug() << "MsScWriter::note()" << "type:" << type << "dots:" << dots << "grace" << grace ; if (!stepAlterOctMap.contains(pitch) || !typeMap.contains(type)) { // TODO: error message return; } StepAlterOct sao = stepAlterOctMap.value(pitch); int ticks = 4 * MScore::division / type.toInt(); if (dots) ticks = 3 * ticks / 2; qDebug() << "ticks:" << ticks; TDuration durationType(TDuration::V_INVALID); durationType.setVal(ticks); qDebug() << "duration:" << durationType.name(); if (triplet != ST_NONE) ticks = 2 * ticks / 3; BeamMode bm = (beamList.at(0) == Bww::BM_BEGIN) ? BEAM_BEGIN : BEAM_AUTO; Direction sd = AUTO; // create chord Chord* cr = new Chord(score); //ws cr->setTick(tick); cr->setBeamMode(bm); cr->setTrack(0); if (grace) { cr->setNoteType(NOTE_GRACE32); cr->setDurationType(TDuration::V_32ND); sd = UP; } else { if (durationType.type() == TDuration::V_INVALID) durationType.setType(TDuration::V_QUARTER); cr->setDurationType(durationType); sd = DOWN; } cr->setDuration(durationType.fraction()); cr->setDots(dots); cr->setStemDirection(sd); // add note to chord Note* note = new Note(score); note->setTrack(0); xmlSetPitch(note, sao.s.toAscii(), sao.a, sao.o); if (tieStart) { Tie* tie = new Tie(score); note->setTieFor(tie); tie->setStartNote(note); tie->setTrack(0); } cr->add(note); // add chord to measure Segment* s = currentMeasure->getSegment(cr, tick); s->add(cr); if (!grace) { doTriplet(cr, triplet); int tickBefore = tick; tick += ticks; Fraction nl(Fraction::fromTicks(tick - currentMeasure->tick())); currentMeasure->setLen(nl); qDebug() << "MsScWriter::note()" << "tickBefore:" << tickBefore << "tick:" << tick << "nl:" << nl.print() ; } }