本文整理汇总了C++中MeasureBase类的典型用法代码示例。如果您正苦于以下问题:C++ MeasureBase类的具体用法?C++ MeasureBase怎么用?C++ MeasureBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MeasureBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addText
static void addText(Score* score, int subtype, const QString& s)
{
MeasureBase* measure = score->first();
if (measure == 0 || measure->type() != VBOX) {
score->insertMeasure(VBOX, measure);
measure = score->first();
}
Text* text = new Text(score);
switch(subtype) {
case TEXT_TITLE:
text->setTextStyleType(TEXT_STYLE_TITLE);
break;
case TEXT_SUBTITLE:
text->setTextStyleType(TEXT_STYLE_SUBTITLE);
break;
case TEXT_COMPOSER:
text->setTextStyleType(TEXT_STYLE_COMPOSER);
break;
case TEXT_POET:
text->setTextStyleType(TEXT_STYLE_POET);
break;
}
text->setParent(measure);
text->setText(s);
score->undoAddElement(text);
}
示例2: scanElements
void Page::doRebuildBspTree()
{
int n = 0;
scanElements(&n, countElements, false);
QRectF r;
if (score()->layoutMode() == LayoutMode::LINE) {
qreal w = 0.0;
qreal h = 0.0;
if (!_systems.empty()) {
h = _systems.front()->height();
if (!_systems.front()->measures().empty()) {
MeasureBase* mb = _systems.front()->measures().back();
w = mb->x() + mb->width();
}
}
r = QRectF(0.0, 0.0, w, h);
}
else
r = abbox();
bspTree.initialize(r, n);
scanElements(&bspTree, &bspInsert, false);
bspTreeValid = true;
}
示例3: scanElements
void Page::doRebuildBspTree()
{
QList<Element*> el;
for (System* s : _systems) {
for (MeasureBase* m : s->measures())
m->scanElements(&el, collectElements, false);
}
scanElements(&el, collectElements, false);
int n = el.size();
if (score()->layoutMode() == LayoutMode::LINE) {
if (_systems.isEmpty())
return;
if (_systems.front()->measures().isEmpty())
return;
qreal h = _systems.front()->height();
MeasureBase* mb = _systems.front()->measures().back();
qreal w = mb->x() + mb->width();
bspTree.initialize(QRectF(0.0, 0.0, w, h), n);
}
else
bspTree.initialize(abbox(), n);
for (int i = 0; i < n; ++i)
bspTree.insert(el.at(i));
bspTreeValid = true;
}
示例4: nextMeasure
Measure* MeasureBase::nextMeasure() const
{
MeasureBase* m = _next;
for (;;) {
if (m == 0 || m->isMeasure())
break;
m = m->_next;
}
return toMeasure(m);
}
示例5: prev
Measure* MeasureBase::prevMeasure() const
{
MeasureBase* m = prev();
while (m) {
if (m->isMeasure())
return toMeasure(m);
m = m->prev();
}
return 0;
}
示例6: score
int MeasureBase::index() const
{
int idx = 0;
MeasureBase* m = score()->first();
while (m) {
if (m == this)
return idx;
m = m->next();
}
return -1;
}
示例7:
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;
}
示例8: prev
Segment* Segment::prev1() const
{
if (prev())
return prev();
MeasureBase* m = measure();
for (;;) {
m = m->prev();
if (m == 0)
return 0;
if (m->type() == MEASURE)
return static_cast<Measure*>(m)->last();
}
}
示例9: 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();
}
}
示例10: addTitleToScore
void addTitleToScore(Score *score, const QString &string, int textCounter)
{
Text* text = new Text(score);
if (textCounter == 1)
text->setSubStyle(SubStyle::TITLE);
else if (textCounter == 2)
text->setSubStyle(SubStyle::COMPOSER);
text->setPlainText(string.right(string.size() - TEXT_PREFIX.size()));
MeasureBase* measure = score->first();
if (measure->type() != Element::Type::VBOX) {
measure = new VBox(score);
measure->setTick(0);
measure->setNext(score->first());
score->measures()->add(measure);
}
measure->add(text);
}
示例11: 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;
}
示例12: addTitleToScore
void addTitleToScore(Score *score, const QString &string, int textCounter)
{
Tid ssid = Tid::DEFAULT;
if (textCounter == 1)
ssid = Tid::TITLE;
else if (textCounter == 2)
ssid = Tid::COMPOSER;
Text* text = new Text(score, ssid);
text->setPlainText(string.right(string.size() - int(TEXT_PREFIX.size())));
MeasureBase* measure = score->first();
if (!measure->isVBox()) {
measure = new VBox(score);
measure->setTick(0);
measure->setNext(score->first());
score->measures()->add(measure);
}
measure->add(text);
}
示例13: printf
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;
}
}
示例14: addTitle
void addTitle(Score *score, const QString &string, int *textCounter)
{
if (string.left(TEXT_PREFIX.size()) == QString::fromStdString(TEXT_PREFIX)) {
++*textCounter;
Text* text = new Text(score);
if (*textCounter == 1)
text->setTextStyleType(TextStyleType::TITLE);
else if (*textCounter == 2)
text->setTextStyleType(TextStyleType::COMPOSER);
text->setText(string.right(string.size() - TEXT_PREFIX.size()));
MeasureBase* measure = score->first();
if (measure->type() != Element::Type::VBOX) {
measure = new VBox(score);
measure->setTick(0);
measure->setNext(score->first());
score->measures()->add(measure);
}
measure->add(text);
}
}
示例15: setScore
void PlayPanel::setScore(Score* s)
{
if (cs != 0 && cs == s)
return;
cs = s;
if (cs) {
MeasureBase* lm = cs->last();
if (lm)
setEndpos(lm->tick() + lm->ticks());
}
bool enable = cs != 0;
volumeSlider->setEnabled(enable);
posSlider->setEnabled(enable);
tempoSlider->setEnabled(enable);
swingStyle->setEnabled(enable);
if (cs) {
setTempo(cs->tempomap()->tempo(0));
setRelTempo(cs->tempomap()->relTempo());
Measure* m = cs->lastMeasure();
if (m)
setEndpos(m ? m->tick() + m->ticks() : 0);
int tick = cs->playPos();
heartBeat(tick, tick);
}
else {
setTempo(120.0);
setRelTempo(1.0);
setEndpos(0);
heartBeat(0, 0);
}
// heartBeat2(seq->getCurTime());
// int tick, utick;
// seq->getCurTick(&tick, &utick);
// heartBeat(tick, utick);
update();
}