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


C++ LayoutBreak类代码示例

本文整理汇总了C++中LayoutBreak的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBreak类的具体用法?C++ LayoutBreak怎么用?C++ LayoutBreak使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LayoutBreak类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tag

void Box::read(const QDomElement& de)
      {
      _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
      bool keepMargins = false;        // whether original margins have to be kept when reading old file

      for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
            const QString& tag(e.tagName());
            const QString& text(e.text());
            if (tag == "height")
                  _boxHeight = Spatium(text.toDouble());
            else if (tag == "width")
                  _boxWidth = Spatium(text.toDouble());
            else if (tag == "topGap")
                  _topGap = text.toDouble();
            else if (tag == "bottomGap")
                  _bottomGap = text.toDouble();
            else if (tag == "leftMargin")
                  _leftMargin = text.toDouble();
            else if (tag == "rightMargin")
                  _rightMargin = text.toDouble();
            else if (tag == "topMargin")
                  _topMargin = text.toDouble();
            else if (tag == "bottomMargin")
                  _bottomMargin = text.toDouble();
            else if (tag == "Text") {
                  Text* t;
                  if (type() == TBOX) {
                        t = static_cast<TBox*>(this)->getText();
                        t->read(e);
                        }
                  else {
                        t = new Text(score());
                        t->read(e);
                        add(t);
                        if (score()->mscVersion() <= 114)
                              t->setLayoutToParentWidth(true);
                        }
                  }
            else if (tag == "Symbol") {
                  Symbol* s = new Symbol(score());
                  s->read(e);
                  add(s);
                  }
            else if (tag == "Image") {
                  // look ahead for image type
                  QString path;
                  QDomElement ee = e.firstChildElement("path");
                  if (!ee.isNull())
                        path = ee.text();
                  Image* image = 0;
                  QString s(path.toLower());
                  if (s.endsWith(".svg"))
                        image = new SvgImage(score());
                  else
                        if (s.endsWith(".jpg")
                     || s.endsWith(".png")
                     || s.endsWith(".gif")
                     || s.endsWith(".xpm")
                        ) {
                        image = new RasterImage(score());
                        }
                  else {
                        qDebug("unknown image format <%s>\n", path.toLatin1().data());
                        }
                  if (image) {
                        image->setTrack(score()->curTrack);
                        image->read(e);
                        add(image);
                        }
                  }
            else if (tag == "FretDiagram") {
                  FretDiagram* f = new FretDiagram(score());
                  f->read(e);
                  add(f);
                  }
            else if (tag == "LayoutBreak") {
                  LayoutBreak* lb = new LayoutBreak(score());
                  lb->read(e);
                  add(lb);
                  }
            else if (tag == "HBox") {
                  HBox* hb = new HBox(score());
                  hb->read(e);
                  add(hb);
                  keepMargins = true;     // in old file, box nesting used outer box margins
                  }
            else if (tag == "VBox") {
                  VBox* vb = new VBox(score());
                  vb->read(e);
                  add(vb);
                  keepMargins = true;     // in old file, box nesting used outer box margins
                  }
            else
                  domError(e);
            }

      // with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
      // for backward compatibility set them to 0 in all other cases

      if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins)  {
//.........这里部分代码省略.........
开发者ID:alexkonradi,项目名称:MuseScore,代码行数:101,代码来源:box.cpp

示例2: LayoutBreak

Palette* MuseScore::newBreaksPalette()
{
    qreal _spatium = gscore->spatium();
    Palette* sp = new Palette;
    sp->setName(QT_TRANSLATE_NOOP("Palette", "Breaks && Spacer"));
    sp->setMag(.7);
    sp->setGrid(42, 36);
    sp->setDrawGrid(true);

    LayoutBreak* lb = new LayoutBreak(gscore);
    lb->setLayoutBreakType(LAYOUT_BREAK_LINE);
    sp->append(lb, tr("Line break"));

    lb = new LayoutBreak(gscore);
    lb->setLayoutBreakType(LAYOUT_BREAK_PAGE);
    sp->append(lb, tr("Page break"));

    lb = new LayoutBreak(gscore);
    lb->setLayoutBreakType(LAYOUT_BREAK_SECTION);
    sp->append(lb, tr("Section break"));

    Spacer* spacer = new Spacer(gscore);
    spacer->setGap(3 * _spatium);
    spacer->setSpacerType(SPACER_DOWN);
    sp->append(spacer, tr("Staff spacer down"));

    spacer = new Spacer(gscore);
    spacer->setGap(3 * _spatium);
    spacer->setSpacerType(SPACER_UP);
    sp->append(spacer, tr("Staff spacer up"));
    return sp;
}
开发者ID:sbradl,项目名称:MuseScore,代码行数:32,代码来源:menus.cpp

示例3: readScore

void TestSpanners::spanners13()
{
    DropData          dropData;
    LayoutBreak*      brk;

    MasterScore* score = readScore(DIR + "lyricsline06.mscx");
    QVERIFY(score);
    score->doLayout();

    // DROP A BREAK AT FIRST MEASURE AND VERIFY
    Measure*    msr   = score->firstMeasure();
    QVERIFY(msr);
    brk               = new LayoutBreak(score);
    brk->setLayoutBreakType(LayoutBreak::Type::LINE);
    dropData.pos      = msr->pagePos();
    dropData.element  = brk;
    score->startCmd();
    msr->drop(dropData);
    score->endCmd();
    // VERIFY SEGMENTS IN SYSTEMS AND THEN SCORE
    for (System* sys : score->systems())
        QVERIFY(sys->spannerSegments().size() == 1);
    QVERIFY(saveCompareScore(score, "lyricsline06.mscx", DIR + "lyricsline06-ref.mscx"));

    // UNDO AND VERIFY
    score->undoStack()->undo();
    score->doLayout();      // systems need to be re-computed
    QVERIFY(saveCompareScore(score, "lyricsline06.mscx", DIR + "lyricsline06.mscx"));
    delete score;
}
开发者ID:sidewayss,项目名称:MuseScore,代码行数:30,代码来源:tst_spanners.cpp

示例4: PaletteScrollArea

void MuseScore::showLayoutBreakPalette()
      {
      if (layoutBreakPalette == 0) {
            qreal _spatium = gscore->spatium();
            Palette* sp    = new Palette;
            layoutBreakPalette = new PaletteScrollArea(sp);
            layoutBreakPalette->setRestrictHeight(false);
            layoutBreakPalette->setWindowTitle(tr("MuseScore: Breaks & Spacer"));
            sp->setGrid(80, 80);
            sp->resize(240,80);

            LayoutBreak* lb = new LayoutBreak(gscore);
            lb->setSubtype(LAYOUT_BREAK_LINE);
            sp->append(lb, tr("Line break"));

            lb = new LayoutBreak(gscore);
            lb->setSubtype(LAYOUT_BREAK_PAGE);
            sp->append(lb, tr("Page break"));

            lb = new LayoutBreak(gscore);
            lb->setSubtype(LAYOUT_BREAK_SECTION);
            sp->append(lb, tr("Section break"));

            Spacer* spacer = new Spacer(gscore);
            spacer->setGap(_spatium * 3);
            sp->append(spacer, tr("Staff spacer"));
            }
      layoutBreakPalette->show();
      layoutBreakPalette->raise();
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:30,代码来源:menus.cpp

示例5: tag

bool MeasureBase::readProperties(XmlReader& e)
      {
      const QStringRef& tag(e.name());
      if (tag == "LayoutBreak") {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->read(e);
            bool doAdd = true;
            switch (lb->layoutBreakType()) {
                  case LayoutBreak::LINE:
                        if (lineBreak())
                              doAdd = false;
                        break;
                  case LayoutBreak::PAGE:
                        if (pageBreak())
                              doAdd = false;
                        break;
                  case LayoutBreak::SECTION:
                        if (sectionBreak())
                              doAdd = false;
                        break;
                  case LayoutBreak::NOBREAK:
                        if (noBreak())
                              doAdd = false;
                        break;
                  }
            if (doAdd) {
                  add(lb);
                  cleanupLayoutBreaks(false);
                  }
            else
                  delete lb;
            }
      else if (tag == "StaffTypeChange") {
            StaffTypeChange* stc = new StaffTypeChange(score());
            stc->setTrack(e.track());
            stc->setParent(this);
            stc->read(e);
            add(stc);
            }
      else if (Element::readProperties(e))
            ;
      else
            return false;
      return true;
      }
开发者ID:CammyVee,项目名称:MuseScore,代码行数:45,代码来源:measurebase.cpp

示例6: switch

void MeasureBase::undoSetBreak(bool v, LayoutBreak::Type type)
      {
      switch (type) {
            case LayoutBreak::LINE:
                  if (lineBreak() == v)
                        return;
                  setLineBreak(v);
                  break;
            case LayoutBreak::PAGE:
                  if (pageBreak() == v)
                        return;
                  if (v && lineBreak())
                        setLineBreak(false);
                  setPageBreak(v);
                  break;
            case LayoutBreak::SECTION:
                  if (sectionBreak() == v)
                        return;
                  if (v && lineBreak())
                        setLineBreak(false);
                  setSectionBreak(v);
                  break;
            case LayoutBreak::NOBREAK:
                  if (noBreak() == v)
                        return;
                  if (v) {
                        setLineBreak(false);
                        setPageBreak(false);
                        setSectionBreak(false);
                        }
                  setNoBreak(v);
                  break;
            }

      if (v) {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->setLayoutBreakType(type);
            lb->setTrack(-1);       // this are system elements
            lb->setParent(this);
            score()->undoAddElement(lb);
            }
      cleanupLayoutBreaks(true);
      }
开发者ID:CammyVee,项目名称:MuseScore,代码行数:43,代码来源:measurebase.cpp

示例7: qDebug

void MsScWriter::endMeasure(const Bww::MeasureEndFlags mef)
      {
      qDebug() << "MsScWriter::endMeasure()";
      if (mef.repeatEnd)
            currentMeasure->setRepeatFlags(RepeatEnd);

      if (mef.endingEnd) {
            if (lastVolta) {
                  qDebug("adding volta\n");
                  if (ending == 1)
                        lastVolta->setSubtype(VOLTA_CLOSED);
                  else
                        lastVolta->setSubtype(VOLTA_OPEN);
                  lastVolta->setEndElement(currentMeasure);
                  currentMeasure->addSpannerBack(lastVolta);
                  lastVolta = 0;
                  }
            else {
                  qDebug("lastVolta == 0 on stop\n");
                  }
            }

      if (mef.lastOfSystem) {
            LayoutBreak* lb = new LayoutBreak(score);
            lb->setTrack(0);
            lb->setSubtype(LAYOUT_BREAK_LINE);
            currentMeasure->add(lb);
            }

      if (mef.lastOfPart && !mef.repeatEnd) {
            currentMeasure->setEndBarLineType(END_BAR, false, true);
            }
      else if (mef.doubleBarLine) {
            currentMeasure->setEndBarLineType(DOUBLE_BAR, false, true);
            }
      // BarLine* barLine = new BarLine(score);
      // bool visible = true;
      // barLine->setSubtype(NORMAL_BAR);
      // barLine->setTrack(0);
      // currentMeasure->setEndBarLineType(barLine->subtype(), false, visible);
      }
开发者ID:kcleung,项目名称:MuseScore,代码行数:41,代码来源:importbww.cpp

示例8: readScore

void TestBarline::barline05()
      {
      Score* score = readScore(DIR + "barline05.mscx");
      QVERIFY(score);
      score->doLayout();

      // 'go' to 4th measure
      Measure* msr = score->firstMeasure();
      for (int i=0; i < 3; i++)
            msr = msr->nextMeasure();
      // create and add a LineBreak element
      LayoutBreak* lb = new LayoutBreak(score);
      lb->setLayoutBreakType(LayoutBreak::Type::LINE);
      lb->setTrack(-1);             // system-level element
      lb->setParent(msr);
      score->undoAddElement(lb);
      score->doLayout();

      // check an end-repeat bar line has been created at the end of this measure and it is generated
      Segment* seg = msr->findSegment(SegmentType::EndBarLine, msr->tick()+msr->ticks());
      QVERIFY2(seg != nullptr, "No SegEndBarLine segment in measure 4.");
      BarLine* bar = static_cast<BarLine*>(seg->element(0));
      QVERIFY2(bar != nullptr, "No end-repeat barline in measure 4.");
      QVERIFY2(bar->barLineType() == BarLineType::END_REPEAT, "Barline at measure 4 is not END-REPEAT");
      QVERIFY2(bar->generated(), "End-repeat barline in measure 4 is non-generated.");

      // // check an end-repeat bar line has been created at the beginning of the next measure and it is not generated
      // check an end-repeat bar line has been created at the beginning of the next measure and it is generated
      msr = msr->nextMeasure();
      seg = msr->findSegment(SegmentType::StartRepeatBarLine, msr->tick());
      QVERIFY2(seg != nullptr, "No SegStartRepeatBarLine segment in measure 5.");
      bar = static_cast<BarLine*>(seg->element(0));
      QVERIFY2(bar != nullptr, "No start-repeat barline in measure 5.");
      QVERIFY2(bar->generated(), "Start-reapeat barline in measure 5 is not generated.");

//      QVERIFY(saveCompareScore(score, "barline05.mscx", DIR + "barline05-ref.mscx"));
      delete score;
      }
开发者ID:Jojo-Schmitz,项目名称:MuseScore,代码行数:38,代码来源:tst_barline.cpp

示例9: LayoutBreak

Palette* MuseScore::newBreaksPalette()
      {
      qreal _spatium = gscore->spatium();
      Palette* sp = new Palette;
      sp->setName(QT_TRANSLATE_NOOP("Palette", "Breaks && Spacers"));
      sp->setMag(1.0);
      sp->setGrid(42, 36);
      sp->setDrawGrid(true);

      LayoutBreak* lb = new LayoutBreak(gscore);
      lb->setLayoutBreakType(LayoutBreak::Type::LINE);
      PaletteCell* cell = sp->append(lb, tr("Line break"));
      cell->mag = 1.2;

      lb = new LayoutBreak(gscore);
      lb->setLayoutBreakType(LayoutBreak::Type::PAGE);
      cell = sp->append(lb, tr("Page break"));
      cell->mag = 1.2;

      lb = new LayoutBreak(gscore);
      lb->setLayoutBreakType(LayoutBreak::Type::SECTION);
      cell = sp->append(lb, tr("Section break"));
      cell->mag = 1.2;

      Spacer* spacer = new Spacer(gscore);
      spacer->setSpacerType(SpacerType::DOWN);
      spacer->setGap(3 * _spatium);
      cell = sp->append(spacer, tr("Staff spacer down"));
      cell->mag = .7;

      spacer = new Spacer(gscore);
      spacer->setSpacerType(SpacerType::UP);
      spacer->setGap(3 * _spatium);
      cell = sp->append(spacer, tr("Staff spacer up"));
      cell->mag = .7;
      return sp;
      }
开发者ID:jasonmarkbeaton,项目名称:MuseScore,代码行数:37,代码来源:menus.cpp

示例10: Omr

bool MuseScore::importPdf(Score* score, const QString& path)
      {
      Omr* omr = new Omr(path, score);
      if (!omr->readPdf()) {
            delete omr;
            return false;
            }
      score->setOmr(omr);
      qreal sp = omr->spatiumMM();
      if (sp == 0.0)
            sp = 1.5;
      score->setSpatium(sp * DPMM);
      score->style()->set(StyleVal(ST_pageFillLimit, 1.0));
      score->style()->set(StyleVal(ST_lastSystemFillLimit, 0.0));
      score->style()->set(StyleVal(ST_staffLowerBorder, 0.0));
      score->style()->set(StyleVal(ST_measureSpacing, 1.0));

      PageFormat pF(*score->pageFormat());
      pF.setEvenLeftMargin(5.0 * DPMM / DPI);
      pF.setEvenTopMargin(0);
      pF.setEvenBottomMargin(0);
      pF.setOddLeftMargin(5.0 * DPMM / DPI);
      pF.setOddTopMargin(0);
      pF.setOddBottomMargin(0);
      score->setPageFormat(pF);

      score->style()->set(StyleVal(ST_systemDistance,   Spatium(omr->systemDistance())));
      score->style()->set(StyleVal(ST_akkoladeDistance, Spatium(omr->staffDistance())));

      Part* part   = new Part(score);
      Staff* staff = new Staff(score, part, 0);
      part->staves()->push_back(staff);
      score->staves().insert(0, staff);
      staff = new Staff(score, part, 1);
      part->staves()->push_back(staff);
      score->staves().insert(1, staff);
      part->staves()->front()->setBarLineSpan(part->nstaves());
      score->insertPart(part, 0);

      TDuration d(TDuration::V_MEASURE);
      Measure* measure = 0;
      int tick = 0;
      foreach(const OmrPage* omrPage, omr->pages()) {
            int nsystems = omrPage->systems().size();
            int n = nsystems == 0 ? 1 : nsystems;
            for (int k = 0; k < n; ++k) {
                  int numMeasures = 1;
                  if (k < nsystems) {
                        const OmrSystem& omrSystem = omrPage->systems().at(k);
                        numMeasures = omrSystem.barLines.size() - 1;
                        if (numMeasures < 1)
                              numMeasures = 1;
                        else if (numMeasures > 50)    // sanity check
                              numMeasures = 50;
                        }
                  for (int i = 0; i < numMeasures; ++i) {
                        measure = new Measure(score);
                        measure->setTick(tick);

		            Rest* rest = new Rest(score, d);
                        rest->setDuration(Fraction(4,4));
                        rest->setTrack(0);
                        Segment* s = measure->getSegment(SegChordRest, tick);
		            s->add(rest);
		            rest = new Rest(score, d);
                        rest->setDuration(Fraction(4,4));
                        rest->setTrack(4);
		            s->add(rest);

                        score->measures()->add(measure);
                        tick += MScore::division * 4;
                        }
                  if (k < (nsystems-1)) {
                        LayoutBreak* b = new LayoutBreak(score);
                        b->setSubtype(LAYOUT_BREAK_LINE);
                        measure->add(b);
                        }
                  }
            if (measure) {
                  LayoutBreak* b = new LayoutBreak(score);
                  b->setSubtype(LAYOUT_BREAK_PAGE);
                  measure->add(b);
                  }
            }

      //---create bracket

      score->staff(0)->setBracket(0, BRACKET_AKKOLADE);
      score->staff(0)->setBracketSpan(0, 2);

      //---create clefs

      measure = score->firstMeasure();
      if (measure) {
            Clef* clef = new Clef(score);
            clef->setClefType(CLEF_G);
            clef->setTrack(0);
            Segment* segment = measure->getSegment(SegClef, 0);
            segment->add(clef);

//.........这里部分代码省略.........
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:101,代码来源:importpdf.cpp

示例11: tag

bool Box::readProperties(XmlReader& e)
      {
      const QStringRef& tag(e.name());
      if (tag == "height")
            _boxHeight = Spatium(e.readDouble());
      else if (tag == "width")
            _boxWidth = Spatium(e.readDouble());
      else if (tag == "topGap") {
            _topGap = e.readDouble();
            if (score()->mscVersion() >= 203)
                  _topGap *= score()->spatium();
            }
      else if (tag == "bottomGap") {
            _bottomGap = e.readDouble();
             if (score()->mscVersion() >= 203)
                  _bottomGap *= score()->spatium();
            }
      else if (tag == "leftMargin")
            _leftMargin = e.readDouble();
      else if (tag == "rightMargin")
            _rightMargin = e.readDouble();
      else if (tag == "topMargin")
            _topMargin = e.readDouble();
      else if (tag == "bottomMargin")
            _bottomMargin = e.readDouble();
      else if (tag == "Text") {
            Text* t;
            if (type() == Element::Type::TBOX) {
                  t = static_cast<TBox*>(this)->text();
                  t->read(e);
                  }
            else {
                  t = new Text(score());
                  t->read(e);
                  if (t->isEmpty()) {
                        qDebug("read empty text");
                        }
                  else
                        add(t);
                  }
            }
      else if (tag == "Symbol") {
            Symbol* s = new Symbol(score());
            s->read(e);
            add(s);
            }
      else if (tag == "Image") {
            if (MScore::noImages)
                  e.skipCurrentElement();
            else {
                  Image* image = new Image(score());
                  image->setTrack(e.track());
                  image->read(e);
                  add(image);
                  }
            }
      else if (tag == "FretDiagram") {
            FretDiagram* f = new FretDiagram(score());
            f->read(e);
            add(f);
            }
      else if (tag == "LayoutBreak") {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->read(e);
            add(lb);
            }
      else if (tag == "HBox") {
            HBox* hb = new HBox(score());
            hb->read(e);
            add(hb);
            }
      else if (tag == "VBox") {
            VBox* vb = new VBox(score());
            vb->read(e);
            add(vb);
            }
      else if (Element::readProperties(e))
            ;
      else
            return false;
      return true;
      }
开发者ID:FryderykChopin,项目名称:MuseScore,代码行数:82,代码来源:box.cpp

示例12: switch

Element* Box::drop(const DropData& data)
      {
      Element* e = data.element;
      if (e->flag(ElementFlag::ON_STAFF))
            return 0;
      switch (e->type()) {
            case Element::Type::LAYOUT_BREAK:
                  {
                  LayoutBreak* lb = static_cast<LayoutBreak*>(e);
                  if (_pageBreak || _lineBreak) {
                        if (
                           (lb->layoutBreakType() == LayoutBreak::Type::PAGE && _pageBreak)
                           || (lb->layoutBreakType() == LayoutBreak::Type::LINE && _lineBreak)
                           || (lb->layoutBreakType() == LayoutBreak::Type::SECTION && _sectionBreak)
                           ) {
                              //
                              // if break already set
                              //
                              delete lb;
                              break;
                              }
                        foreach (Element* elem, _el) {
                              if (elem->type() == Element::Type::LAYOUT_BREAK) {
                                    score()->undoChangeElement(elem, e);
                                    break;
                                    }
                              }
                        break;
                        }
                  lb->setTrack(-1);       // these are system elements
                  lb->setParent(this);
                  score()->undoAddElement(lb);
                  return lb;
                  }

            case Element::Type::STAFF_TEXT:
                  {
                  Text* text = new Text(score());
                  text->setTextStyleType(TextStyleType::FRAME);
                  text->setParent(this);
                  text->setXmlText(static_cast<StaffText*>(e)->xmlText());
                  score()->undoAddElement(text);
                  delete e;
                  return text;
                  }

            case Element::Type::ICON:
                  switch(static_cast<Icon*>(e)->iconType()) {
                        case IconType::VFRAME:
                              score()->insertMeasure(Element::Type::VBOX, this);
                              break;
                        case IconType::TFRAME:
                              score()->insertMeasure(Element::Type::TBOX, this);
                              break;
                        case IconType::FFRAME:
                              score()->insertMeasure(Element::Type::FBOX, this);
                              break;
                        case IconType::MEASURE:
                              score()->insertMeasure(Element::Type::MEASURE, this);
                              break;
                        default:
                              break;
                        }
                  break;

            case Element::Type::TEXT:
            case Element::Type::IMAGE:
            case Element::Type::SYMBOL:
                  e->setParent(this);
                  score()->undoAddElement(e);
                  return e;

            default:
                  return 0;
            }
      return 0;
      }
开发者ID:FryderykChopin,项目名称:MuseScore,代码行数:77,代码来源:box.cpp

示例13: switch

Element* Box::drop(const DropData& data)
      {
      Element* e = data.element;
      switch(e->type()) {
            case LAYOUT_BREAK:
                  {
                  LayoutBreak* lb = static_cast<LayoutBreak*>(e);
                  if (_pageBreak || _lineBreak) {
                        if (
                           (lb->subtype() == LAYOUT_BREAK_PAGE && _pageBreak)
                           || (lb->subtype() == LAYOUT_BREAK_LINE && _lineBreak)
                           || (lb->subtype() == LAYOUT_BREAK_SECTION && _sectionBreak)
                           ) {
                              //
                              // if break already set
                              //
                              delete lb;
                              break;
                              }
                        foreach(Element* elem, _el) {
                              if (elem->type() == LAYOUT_BREAK) {
                                    score()->undoChangeElement(elem, e);
                                    break;
                                    }
                              }
                        break;
                        }
                  lb->setTrack(-1);       // this are system elements
                  lb->setParent(this);
                  score()->undoAddElement(lb);
                  return lb;
                  }
            case STAFF_TEXT:
                  {
                  Text* text = new Text(score());
                  text->setTextStyle(score()->textStyle(TEXT_STYLE_FRAME));
                  text->setParent(this);
                  text->setHtml(static_cast<StaffText*>(e)->getHtml());
                  score()->undoAddElement(text);
                  delete e;
                  return text;
                  }

            case ICON:
                  switch(static_cast<Icon*>(e)->subtype()) {
                        case ICON_VFRAME:
                              score()->insertMeasure(VBOX, this);
                              break;
                        case ICON_TFRAME:
                              score()->insertMeasure(TBOX, this);
                              break;
                        case ICON_FFRAME:
                              score()->insertMeasure(FBOX, this);
                              break;
                        case ICON_MEASURE:
                              score()->insertMeasure(MEASURE, this);
                              break;
                        }
                  break;

            default:
                  e->setParent(this);
                  score()->undoAddElement(e);
                  return e;
            }
      return 0;
      }
开发者ID:alexkonradi,项目名称:MuseScore,代码行数:67,代码来源:box.cpp

示例14: while

void Box::read(XmlReader& e)
      {
      _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
      bool keepMargins = false;        // whether original margins have to be kept when reading old file

      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "height")
                  _boxHeight = Spatium(e.readDouble());
            else if (tag == "width")
                  _boxWidth = Spatium(e.readDouble());
            else if (tag == "topGap")
                  _topGap = e.readDouble();
            else if (tag == "bottomGap")
                  _bottomGap = e.readDouble();
            else if (tag == "leftMargin")
                  _leftMargin = e.readDouble();
            else if (tag == "rightMargin")
                  _rightMargin = e.readDouble();
            else if (tag == "topMargin")
                  _topMargin = e.readDouble();
            else if (tag == "bottomMargin")
                  _bottomMargin = e.readDouble();
            else if (tag == "Text") {
                  Text* t;
                  if (type() == TBOX) {
                        t = static_cast<TBox*>(this)->getText();
                        t->read(e);
                        }
                  else {
                        t = new Text(score());
                        t->read(e);
                        add(t);
                        if (score()->mscVersion() <= 114)
                              t->setLayoutToParentWidth(true);
                        }
                  }
            else if (tag == "Symbol") {
                  Symbol* s = new Symbol(score());
                  s->read(e);
                  add(s);
                  }
            else if (tag == "Image") {
                  Image* image = new Image(score());
                  image->setTrack(e.track());
                  image->read(e);
                  add(image);
                  }
            else if (tag == "FretDiagram") {
                  FretDiagram* f = new FretDiagram(score());
                  f->read(e);
                  add(f);
                  }
            else if (tag == "LayoutBreak") {
                  LayoutBreak* lb = new LayoutBreak(score());
                  lb->read(e);
                  add(lb);
                  }
            else if (tag == "HBox") {
                  HBox* hb = new HBox(score());
                  hb->read(e);
                  add(hb);
                  keepMargins = true;     // in old file, box nesting used outer box margins
                  }
            else if (tag == "VBox") {
                  VBox* vb = new VBox(score());
                  vb->read(e);
                  add(vb);
                  keepMargins = true;     // in old file, box nesting used outer box margins
                  }
            else if (Element::readProperties(e))
                  ;
            else
                  e.unknown();
            }

      // with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
      // for backward compatibility set them to 0 in all other cases

      if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins)  {
            _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
            }
      }
开发者ID:sommerp,项目名称:MuseScore,代码行数:83,代码来源:box.cpp

示例15: populateIconPalette


//.........这里部分代码省略.........
            TempoPattern(QString("%1%2 = 80").    arg(QChar(0xd834)).arg(QChar(0xdd5f)), 80.0/60.0),      // 1/4
            TempoPattern(QString("%1%2 = 80").    arg(QChar(0xd834)).arg(QChar(0xdd5e)), 80.0/30.0),      // 1/2
            TempoPattern(QString("%1%2 = 80").    arg(QChar(0xd834)).arg(QChar(0xdd60)), 80.0/120.0),     // 1/8
            TempoPattern(QString("%1%2%3%4 = 80").arg(QChar(0xd834)).arg(QChar(0xdd5f)).arg(QChar(0xd834)).arg(QChar(0xdd6d)), 120.0/60.0),  // dotted 1/4
            TempoPattern(QString("%1%2%3%4 = 80").arg(QChar(0xd834)).arg(QChar(0xdd5e)).arg(QChar(0xd834)).arg(QChar(0xdd6d)), 120/30.0),    // dotted 1/2
            TempoPattern(QString("%1%2%3%4 = 80").arg(QChar(0xd834)).arg(QChar(0xdd60)).arg(QChar(0xd834)).arg(QChar(0xdd6d)), 120/120.0)    // dotted 1/8
            };
      for (unsigned i = 0; i < sizeof(tp)/sizeof(*tp); ++i) {
            TempoText* tt = new TempoText(gscore);
            tt->setFollowText(true);
            tt->setTrack(0);
            tt->setTempo(tp[i].f);
            tt->setText(tp[i].pattern);
            sp->append(tt, tr("Tempo Text"), QString(), 1.5);
            }

      Harmony* harmony = new Harmony(gscore);
      harmony->setText("c7");
      sp->append(harmony, tr("Chord Name"));

      paletteBox->addPalette(sp);

      //-----------------------------------
      //    breaks
      //-----------------------------------

      qreal _spatium = gscore->spatium();
      sp = new Palette;
      sp->setName(tr("Breaks && Spacer"));
      sp->setMag(.7);
      sp->setGrid(42, 36);
      sp->setDrawGrid(true);

      LayoutBreak* lb = new LayoutBreak(gscore);
      lb->setSubtype(LAYOUT_BREAK_LINE);
      sp->append(lb, tr("Line break"));

      lb = new LayoutBreak(gscore);
      lb->setSubtype(LAYOUT_BREAK_PAGE);
      sp->append(lb, tr("Page break"));

      lb = new LayoutBreak(gscore);
      lb->setSubtype(LAYOUT_BREAK_SECTION);
      sp->append(lb, tr("Section break"));

      Spacer* spacer = new Spacer(gscore);
      spacer->setGap(3 * _spatium);
      spacer->setSubtype(SPACER_DOWN);
      sp->append(spacer, tr("Staff spacer down"));

      spacer = new Spacer(gscore);
      spacer->setGap(3 * _spatium);
      spacer->setSubtype(SPACER_UP);
      sp->append(spacer, tr("Staff spacer up"));

      paletteBox->addPalette(sp);

      //-----------------------------------
      //    staff state changes
      //-----------------------------------

#if 0
      sp = new Palette;
      sp->setName(tr("Staff Changes"));
      sp->setMag(.7);
      sp->setGrid(42, 36);
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:67,代码来源:menus.cpp


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