本文整理汇总了C++中MeasureBase::next方法的典型用法代码示例。如果您正苦于以下问题:C++ MeasureBase::next方法的具体用法?C++ MeasureBase::next怎么用?C++ MeasureBase::next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeasureBase
的用法示例。
在下文中一共展示了MeasureBase::next方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
MeasureBase* Score::tick2measureBase(int tick) const
{
for (MeasureBase* mb = first(); mb; mb = mb->next()) {
int st = mb->tick();
int l = mb->ticks();
if (tick >= st && tick < (st+l))
return mb;
}
// qDebug("tick2measureBase %d not found\n", tick);
return 0;
}
示例2: index
int MeasureBase::index() const
{
int idx = 0;
MeasureBase* m = score()->first();
while (m) {
if (m == this)
return idx;
m = m->next();
}
return -1;
}
示例3: next
Segment* Segment::next1() const
{
if (next())
return next();
MeasureBase* m = measure();
for (;;) {
m = m->next();
if (m == 0)
return 0;
if (m->type() == MEASURE)
return static_cast<Measure*>(m)->first();
}
}
示例4: nextMeasure
ChordRest* Score::nextMeasure(ChordRest* element, bool selectBehavior)
{
if (!element)
return 0;
MeasureBase* mb = element->measure()->next();
while (mb && ((mb->type() != Element::MEASURE) || (mb->type() == Element::MEASURE && static_cast<Measure*>(mb)->multiMeasure() < 0)))
mb = mb->next();
Measure* measure = static_cast<Measure*>(mb);
int endTick = element->measure()->last()->nextChordRest(element->track(), true)->tick();
bool last = false;
if (selection().state() == SEL_RANGE) {
if (element->tick() != endTick && selection().tickEnd() <= endTick) {
measure = element->measure();
last = true;
}
else if (element->tick() == endTick && selection().isEndActive())
last = true;
}
else if (element->tick() != endTick && selectBehavior) {
measure = element->measure();
last = true;
}
if (!measure) {
measure = element->measure();
last = true;
}
int staff = element->staffIdx();
Segment* startSeg = last ? measure->last() : measure->first();
for (Segment* seg = startSeg; seg; seg = last ? seg->prev() : seg->next()) {
int etrack = (staff+1) * VOICES;
for (int track = staff * VOICES; track < etrack; ++track) {
Element* pel = seg->element(track);
if (pel && pel->isChordRest())
return static_cast<ChordRest*>(pel);
}
}
return 0;
}
示例5: setStaves
void Part::setStaves(int n)
{
int ns = _staves.size();
if (n < ns) {
printf("Part::setStaves(): remove staves not implemented!\n");
return;
}
int staffIdx = _score->staffIdx(this) + ns;
for (int i = ns; i < n; ++i) {
Staff* staff = new Staff(_score, this, i);
_staves.push_back(staff);
_score->staves().insert(staffIdx, staff);
for (MeasureBase* mb = _score->first(); mb; mb = mb->next()) {
if (mb->type() != MEASURE)
continue;
Measure* m = static_cast<Measure*>(mb);
m->insertStaff(staff, staffIdx);
}
++staffIdx;
}
}
示例6: write
void Score::write(Xml& xml, bool selectionOnly)
{
// if we have multi measure rests and some parts are hidden,
// then some layout information is missing:
// relayout with all parts set visible
QList<Part*> hiddenParts;
bool unhide = false;
if (styleB(StyleIdx::createMultiMeasureRests)) {
for (Part* part : _parts) {
if (!part->show()) {
if (!unhide) {
startCmd();
unhide = true;
}
part->undoChangeProperty(P_ID::VISIBLE, true);
hiddenParts.append(part);
}
}
}
if (unhide) {
doLayout();
for (Part* p : hiddenParts)
p->setShow(false);
}
xml.stag("Score");
switch(_layoutMode) {
case LayoutMode::PAGE:
case LayoutMode::FLOAT:
case LayoutMode::SYSTEM:
break;
case LayoutMode::LINE:
xml.tag("layoutMode", "line");
break;
}
#ifdef OMR
if (_omr && xml.writeOmr)
_omr->write(xml);
#endif
if (_showOmr && xml.writeOmr)
xml.tag("showOmr", _showOmr);
if (_audio && xml.writeOmr) {
xml.tag("playMode", int(_playMode));
_audio->write(xml);
}
for (int i = 0; i < 32; ++i) {
if (!_layerTags[i].isEmpty()) {
xml.tag(QString("LayerTag id=\"%1\" tag=\"%2\"").arg(i).arg(_layerTags[i]),
_layerTagComments[i]);
}
}
int n = _layer.size();
for (int i = 1; i < n; ++i) { // dont save default variant
const Layer& l = _layer[i];
xml.tagE(QString("Layer name=\"%1\" mask=\"%2\"").arg(l.name).arg(l.tags));
}
xml.tag("currentLayer", _currentLayer);
if (!MScore::testMode)
_synthesizerState.write(xml);
if (pageNumberOffset())
xml.tag("page-offset", pageNumberOffset());
xml.tag("Division", MScore::division);
xml.curTrack = -1;
_style.save(xml, true); // save only differences to buildin style
xml.tag("showInvisible", _showInvisible);
xml.tag("showUnprintable", _showUnprintable);
xml.tag("showFrames", _showFrames);
xml.tag("showMargins", _showPageborders);
QMapIterator<QString, QString> i(_metaTags);
while (i.hasNext()) {
i.next();
if ((!MScore::testMode && !MScore::saveTemplateMode) || (i.key() != "platform" && i.key() != "creationDate"))
xml.tag(QString("metaTag name=\"%1\"").arg(i.key().toHtmlEscaped()), i.value());
}
if (!selectionOnly) {
xml.stag("PageList");
foreach(Page* page, _pages)
page->write(xml);
xml.etag();
}
xml.curTrack = 0;
int staffStart;
int staffEnd;
MeasureBase* measureStart;
MeasureBase* measureEnd;
if (selectionOnly) {
staffStart = _selection.staffStart();
staffEnd = _selection.staffEnd();
// make sure we select full parts
//.........这里部分代码省略.........
示例7: if
//.........这里部分代码省略.........
|| s->type() == Element::Type::TEXTLINE) {
qreal yo = 0;
if (s->type() == Element::Type::OTTAVA) {
// fix ottava position
yo = styleS(StyleIdx::ottavaY).val() * spatium();
if (s->placement() == Element::Placement::BELOW)
yo = -yo + s->staff()->height();
}
else if (s->type() == Element::Type::PEDAL) {
yo = styleS(StyleIdx::pedalY).val() * spatium();
}
else if (s->type() == Element::Type::TRILL) {
yo = styleS(StyleIdx::trillY).val() * spatium();
}
else if (s->type() == Element::Type::TEXTLINE) {
yo = -5.0 * spatium();
}
if (!s->spannerSegments().isEmpty()) {
for (SpannerSegment* seg : s->spannerSegments()) {
if (!seg->userOff().isNull())
seg->setUserYoffset(seg->userOff().y() - yo);
}
}
else {
s->setUserYoffset(-yo);
}
}
}
connectTies();
//
// remove "middle beam" flags from first ChordRest in
// measure
//
for (Measure* m = firstMeasure(); m; m = m->nextMeasure()) {
int tracks = nstaves() * VOICES;
bool first = true;
for (int track = 0; track < tracks; ++track) {
for (Segment* s = m->first(); s; s = s->next()) {
if (s->segmentType() != Segment::Type::ChordRest)
continue;
ChordRest* cr = static_cast<ChordRest*>(s->element(track));
if (cr) {
if(cr->type() == Element::Type::REST) {
Rest* r = static_cast<Rest*>(cr);
if (!r->userOff().isNull()) {
int lineOffset = r->computeLineOffset();
qreal lineDist = r->staff() ? r->staff()->staffType()->lineDistance().val() : 1.0;
r->rUserYoffset() -= (lineOffset * .5 * lineDist * r->spatium());
}
}
if(!first) {
switch(cr->beamMode()) {
case Beam::Mode::AUTO:
case Beam::Mode::BEGIN:
case Beam::Mode::END:
case Beam::Mode::NONE:
break;
case Beam::Mode::MID:
case Beam::Mode::BEGIN32:
case Beam::Mode::BEGIN64:
cr->setBeamMode(Beam::Mode::BEGIN);
break;
case Beam::Mode::INVALID:
if (cr->type() == Element::Type::CHORD)
cr->setBeamMode(Beam::Mode::AUTO);
else
cr->setBeamMode(Beam::Mode::NONE);
break;
}
first = false;
}
}
}
}
}
for (MeasureBase* mb = _measures.first(); mb; mb = mb->next()) {
if (mb->type() == Element::Type::VBOX) {
Box* b = static_cast<Box*>(mb);
qreal y = point(styleS(StyleIdx::staffUpperBorder));
b->setBottomGap(y);
}
}
_fileDivision = MScore::division;
//
// sanity check for barLineSpan and update ottavas
//
foreach(Staff* staff, _staves) {
int barLineSpan = staff->barLineSpan();
int idx = staffIdx(staff);
int n = nstaves();
if (idx + barLineSpan > n) {
qDebug("bad span: idx %d span %d staves %d", idx, barLineSpan, n);
staff->setBarLineSpan(n - idx);
}
staff->updateOttava();
}
示例8: if
void System::layout2()
{
if (isVbox()) // ignore vbox
return;
int nstaves = _staves.size();
qreal _spatium = spatium();
qreal y = 0.0;
int lastStaffIdx = 0; // last visible staff
int firstStaffIdx = -1;
qreal lastStaffDistanceDown = 0.0;
for (int staffIdx = 0; staffIdx < nstaves; ++staffIdx) {
Staff* staff = score()->staff(staffIdx);
StyleIdx downDistance;
qreal userDist = 0.0;
if ((staffIdx + 1) == nstaves) {
//
// last staff in system
//
MeasureBase* mb = ml.last();
bool nextMeasureIsVBOX = false;
if (mb->next()) {
Element::Type type = mb->next()->type();
if (type == Element::Type::VBOX || type == Element::Type::TBOX || type == Element::Type::FBOX)
nextMeasureIsVBOX = true;
}
downDistance = nextMeasureIsVBOX ? StyleIdx::systemFrameDistance : StyleIdx::minSystemDistance;
}
else if (staff->rstaff() < (staff->part()->staves()->size()-1)) {
//
// staff is not last staff in a part
//
downDistance = StyleIdx::akkoladeDistance;
userDist = score()->staff(staffIdx + 1)->userDist();
}
else {
downDistance = StyleIdx::staffDistance;
userDist = score()->staff(staffIdx + 1)->userDist();
}
SysStaff* s = _staves[staffIdx];
qreal distDown = score()->styleS(downDistance).val() * _spatium + userDist;
qreal nominalDistDown = distDown;
qreal distUp = 0.0;
int n = ml.size();
for (int i = 0; i < n; ++i) {
MeasureBase* m = ml.at(i);
distDown = qMax(distDown, m->distanceDown(staffIdx));
distUp = qMax(distUp, m->distanceUp(staffIdx));
}
s->setDistanceDown(distDown);
s->setDistanceUp(distUp);
if (!staff->show() || !s->show()) {
s->setbbox(QRectF()); // already done in layout() ?
continue;
}
qreal sHeight = staff->height();
qreal dup = staffIdx == 0 ? 0.0 : s->distanceUp();
if (staff->lines() == 1)
dup -= _spatium * staff->mag();
s->bbox().setRect(_leftMargin, y + dup, width() - _leftMargin, sHeight);
y += dup + sHeight + s->distanceDown();
lastStaffIdx = staffIdx;
lastStaffDistanceDown = distDown - nominalDistDown;
if (firstStaffIdx == -1)
firstStaffIdx = staffIdx;
}
if (firstStaffIdx == -1)
firstStaffIdx = 0;
qreal systemHeight = staff(lastStaffIdx)->bbox().bottom();
if (lastStaffIdx < nstaves - 1)
systemHeight += lastStaffDistanceDown;
setHeight(systemHeight);
int n = ml.size();
for (int i = 0; i < n; ++i) {
MeasureBase* m = ml.at(i);
if (m->type() == Element::Type::MEASURE) {
// note that the factor 2 * _spatium must be corrected for when exporting
// system distance in MusicXML (issue #24733)
m->bbox().setRect(0.0, -_spatium, m->width(), systemHeight + 2 * _spatium);
}
else if (m->type() == Element::Type::HBOX) {
m->bbox().setRect(0.0, 0.0, m->width(), systemHeight);
static_cast<HBox*>(m)->layout2();
}
}
if (_barLine) {
_barLine->setTrack(firstStaffIdx * VOICES);
_barLine->setSpan(lastStaffIdx - firstStaffIdx + 1);
if (score()->staff(0)->lines() == 1)
_barLine->setSpanFrom(BARLINE_SPAN_1LINESTAFF_FROM);
int spanTo = (score()->staff(lastStaffIdx)->lines() == 1) ?
BARLINE_SPAN_1LINESTAFF_TO :
(score()->staff(lastStaffIdx)->lines()-1)*2;
//.........这里部分代码省略.........