本文整理汇总了C++中BarLine::subtype方法的典型用法代码示例。如果您正苦于以下问题:C++ BarLine::subtype方法的具体用法?C++ BarLine::subtype怎么用?C++ BarLine::subtype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarLine
的用法示例。
在下文中一共展示了BarLine::subtype方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drop
Element* BarLine::drop(const DropData& data)
{
Element* e = data.element;
int type = e->type();
if (type == BAR_LINE) {
BarLine* bl = static_cast<BarLine*>(e);
BarLineType st = bl->subtype();
if (st == subtype()) {
delete e;
return 0;
}
Measure* m = segment()->measure();
if (st == START_REPEAT) {
m = m->nextMeasure();
if (m == 0) {
delete e;
return 0;
}
}
m->drop(data);
}
else if (type == ARTICULATION) {
Articulation* atr = static_cast<Articulation*>(e);
atr->setParent(this);
atr->setTrack(track());
score()->select(atr, SELECT_SINGLE, 0);
score()->undoAddElement(atr);
}
return 0;
}
示例2: acceptDrop
bool BarLine::acceptDrop(MuseScoreView*, const QPointF&, Element* e) const
{
int type = e->type();
if(type == BAR_LINE) {
if (parent() && parent()->type() == SEGMENT) {
return true;
}
if (parent() && parent()->type() == SYSTEM) {
BarLine* b = static_cast<BarLine*>(e);
return (b->subtype() == BROKEN_BAR || b->subtype() == DOTTED_BAR
|| b->subtype() == NORMAL_BAR || b->subtype() == DOUBLE_BAR
|| b->spanFrom() != 0 || b->spanTo() != DEFAULT_BARLINE_TO);
}
}else {
return (type == ARTICULATION
&& parent()
&& parent()->type() == SEGMENT
&& static_cast<Segment*>(parent())->subtype() == Segment::SegEndBarLine);
}
return false;
}
示例3: drop
Element* BarLine::drop(const DropData& data)
{
Element* e = data.element;
int type = e->type();
if (type == BAR_LINE) {
BarLine* bl = static_cast<BarLine*>(e);
BarLineType st = bl->subtype();
// if no change in subtype or no change in span, do nothing
if (st == subtype() && bl->spanFrom() == 0 && bl->spanTo() == DEFAULT_BARLINE_TO) {
delete e;
return 0;
}
// system left-side bar line
if (parent()->type() == SYSTEM) {
BarLine* b = static_cast<System*>(parent())->barLine();
score()->undoChangeProperty(b, P_SUBTYPE, int(bl->subtype()));
delete e;
return 0;
}
// check if the new property can apply to this single bar line
bool oldRepeat = (subtype() == START_REPEAT || subtype() == END_REPEAT
|| subtype() == END_START_REPEAT);
bool newRepeat = (bl->subtype() == START_REPEAT || bl->subtype() == END_REPEAT
|| bl->subtype() == END_START_REPEAT);
// if repeats are not involved or drop refers to span rather than subtype =>
// single bar line drop
if( (!oldRepeat && !newRepeat) || (bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) ) {
// if drop refers to span, update this bar line span
if(bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) {
// if dropped spanFrom or spanTo are below the middle of standard staff (5 lines)
// adjust to the number of syaff lines
int bottomSpan = (staff()->lines()-1) * 2;
int spanFrom = bl->spanFrom() > 4 ? bottomSpan - (8 - bl->spanFrom()) : bl->spanFrom();
int spanTo = bl->spanTo() > 4 ? bottomSpan - (8 - bl->spanTo()) : bl->spanTo();
score()->undoChangeSingleBarLineSpan(this, 1, spanFrom, spanTo);
}
// if drop refer to subtype, update this bar line subtype
else {
score()->undoChangeProperty(this, P_SUBTYPE, int(bl->subtype()));
// setCustomSubtype(true);
}
delete e;
return 0;
}
// drop applies to all bar lines of the measure
Measure* m = static_cast<Segment*>(parent())->measure();
if (st == START_REPEAT) {
m = m->nextMeasure();
if (m == 0) {
delete e;
return 0;
}
}
m->drop(data);
}
else if (type == ARTICULATION) {
Articulation* atr = static_cast<Articulation*>(e);
atr->setParent(this);
atr->setTrack(track());
score()->undoAddElement(atr);
return atr;
}
return 0;
}