当前位置: 首页>>代码示例>>C++>>正文


C++ BarLine::subtype方法代码示例

本文整理汇总了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;
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:30,代码来源:barline.cpp

示例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;
      }
开发者ID:aeliot,项目名称:MuseScore,代码行数:21,代码来源:barline.cpp

示例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;
      }
开发者ID:aeliot,项目名称:MuseScore,代码行数:66,代码来源:barline.cpp


注:本文中的BarLine::subtype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。