Example #1
0
void PageFormat::write(Xml& xml) const
      {
      xml.stag("page-layout");

      // convert inch to 1/10 spatium units
      // 20 - font design size in point
      // SPATIUM = 20/4
      // qreal t = 10 * PPI / (20 / 4);
      qreal t = 2 * PPI;

      xml.tag("page-height", _size.height() * t);
      xml.tag("page-width",  _size.width() * t);

      const char* type = "both";
      if (_twosided) {
            type = "even";
            xml.stag(QString("page-margins type=\"%1\"").arg(type));
            xml.tag("left-margin",   evenLeftMargin() * t);
            xml.tag("right-margin",  evenRightMargin() * t);
            xml.tag("top-margin",    evenTopMargin() * t);
            xml.tag("bottom-margin", evenBottomMargin() * t);
            xml.etag();
            type = "odd";
            }
      xml.stag(QString("page-margins type=\"%1\"").arg(type));
      xml.tag("left-margin",   oddLeftMargin() * t);
      xml.tag("right-margin",  oddRightMargin() * t);
      xml.tag("top-margin",    oddTopMargin() * t);
      xml.tag("bottom-margin", oddBottomMargin() * t);
      xml.etag();

      xml.etag();
      }
Example #2
0
void InstrumentData::write(Xml& xml) const
      {
      xml.stag("Instrument");
      foreach(const StaffNameDoc& doc, _longNames) {
            xml.stag(QString("longName pos=\"%1\"").arg(doc.pos));
            xml.writeHtml(doc.name.toHtml());
            xml.etag();
            }
Example #3
0
void Album::save(Xml& xml)
      {
      xml.stag("Album");
      xml.tag("name", _name);
      for (AlbumItem* item : _scores) {
            xml.stag("Score");
            xml.tag("name", item->name);
            xml.tag("path", item->path);
            xml.etag();
            }
      xml.etag();
      _dirty = false;
      }
Example #4
0
void TextLine::writeProperties(Xml& xml, const TextLine* proto) const
      {
      if (_beginHook) {
            if (proto == 0 || proto->beginHookHeight() != _beginHookHeight)
                  xml.tag("beginHookHeight", _beginHookHeight.val());
            if (proto == 0 || proto->beginHookType() != _beginHookType)
                  xml.tag("beginHookType", int(_beginHookType));
            }
      if (_endHook) {
            if (proto == 0 || proto->endHookHeight() != _endHookHeight)
                  xml.tag("endHookHeight", _endHookHeight.val());
            if (proto == 0 || proto->endHookType() != _endHookType)
                  xml.tag("endHookType", int(_endHookType));
            }

      if (proto == 0 || proto->lineWidth() != _lineWidth)
            xml.tag("lineWidth", _lineWidth.val());
      if (proto == 0 || proto->lineStyle() != _lineStyle)
            xml.tag("lineStyle", int(_lineStyle));
      if (proto == 0 || proto->lineColor() != _lineColor)
            xml.tag("lineColor", _lineColor);
      if (proto == 0 || proto->beginTextPlace() != _beginTextPlace)
            xml.pTag("beginTextPlace", _beginTextPlace);
      if (proto == 0 || proto->continueTextPlace() != _continueTextPlace)
            xml.pTag("continueTextPlace", _continueTextPlace);

      SLine::writeProperties(xml);
      if (_beginText) {
            xml.stag("beginText");
            _beginText->writeProperties(xml);
            xml.etag();
            }
      if (_continueText) {
            xml.stag("continueText");
            _continueText->writeProperties(xml);
            xml.etag();
            }
      if (_beginSymbol != -1) {
            xml.tag("beginSymbol", Sym::id2name(_beginSymbol));
            xml.tag("beginSymbolOffset", _beginSymbolOffset);
            }
      if (_continueSymbol != -1) {
            xml.tag("continueSymbol", Sym::id2name(_continueSymbol));
            xml.tag("continueSymbolOffset", _continueSymbolOffset);
            }
      if (_endSymbol != -1) {
            xml.tag("endSymbol", Sym::id2name(_endSymbol));
            xml.tag("endSymbolOffset", _endSymbolOffset);
            }
      }
Example #5
0
void InstrumentChange::write(Xml& xml) const
      {
      xml.stag("InstrumentChange");
      _instrument.write(xml);
      Text::writeProperties(xml);
      xml.etag();
      }
Example #6
0
void Fingering::write(Xml& xml) const
      {
      if (!xml.canWrite(this)) return;
      xml.stag(name());
      Text::writeProperties(xml);
      xml.etag();
      }
Example #7
0
void Breath::write(Xml& xml) const
      {
      xml.stag("Breath");
      xml.tag("subtype", _breathType);
      Element::writeProperties(xml);
      xml.etag();
      }
Example #8
0
void TimeSigMap::write(Xml& xml) const
      {
      xml.stag("siglist");
      for (ciSigEvent i = begin(); i != end(); ++i)
            i->second.write(xml, i->first);
      xml.etag();
      }
Example #9
0
void SigEvent::write(Xml& xml, int tick) const
      {
      xml.stag(QString("sig tick=\"%1\"").arg(tick));
      xml.tag("nom",   _timesig.numerator());
      xml.tag("denom", _timesig.denominator());
      xml.etag();
      }
Example #10
0
void Symbol::write(Xml& xml) const
      {
      xml.stag(name());
      xml.tag("name", Sym::id2name(_sym));
      BSymbol::writeProperties(xml);
      xml.etag();
      }
Example #11
0
void TBox::write(Xml& xml) const
      {
      xml.stag(name());
      Box::writeProperties(xml);
      _text->write(xml);
      xml.etag();
      }
Example #12
0
void Album::write(Xml& xml)
      {
      xml.header();
      xml.stag("museScore version=\"" MSC_VERSION "\"");
      save(xml);
      xml.etag();
      }
Example #13
0
void SyntiState::write(Xml& xml) const
      {
      xml.stag("SyntiSettings");
      foreach(const SyntiParameter& sp, *this)
            sp.write(xml);
      xml.etag();
      }
Example #14
0
void Drumset::save(Xml& xml)
      {
      for (int i = 0; i < 128; ++i) {
            if (!isValid(i))
                  continue;
            xml.stag(QString("Drum pitch=\"%1\"").arg(i));
            xml.tag("head", int(noteHead(i)));
            xml.tag("line", line(i));
            xml.tag("voice", voice(i));
            xml.tag("name", name(i));
            xml.tag("stem", int(stemDirection(i)));
            if (shortcut(i)) {
                  switch (shortcut(i)) {
                        case 'C':
                        case 'D':
                        case 'E':
                        case 'F':
                        case 'G':
                        case 'A':
                        case 'B':
                              {
                              char a[2];
                              a[0] = shortcut(i);
                              a[1] = 0;
                              xml.tag("shortcut", a);
                              }
                              break;
                        default:
                              qDebug("illegal drum shortcut");
                              break;
                        }
                  }
            xml.etag();
            }
      }
Example #15
0
void Tremolo::write(Xml& xml) const
      {
      xml.stag(name());
      xml.tag("subtype", tremoloTypeName());
      Element::writeProperties(xml);
      xml.etag();
      }
Example #16
0
void Marker::write(Xml& xml) const
      {
      xml.stag(name());
      Text::writeProperties(xml);
      xml.tag("label", _label);
      xml.etag();
      }
Example #17
0
File: sig.cpp Project: faesong/oom
void SigList::write(Xml& xml) const
	{
		xml.stag("siglist");
		for (ciSigEvent i = begin(); i != end(); ++i)
			i->second->write(xml, i->first);
		xml.etag("siglist");
	}
Example #18
0
void Spacer::write(Xml& xml) const
      {
      xml.stag(name());
      Element::writeProperties(xml);
      xml.tag("space", _gap / spatium());
      xml.etag();
      }
Example #19
0
void SlurSegment::write(Xml& xml, int no) const
      {
      if (ups[GRIP_START].off.isNull()
         && ups[GRIP_END].off.isNull()
         && ups[GRIP_BEZIER1].off.isNull()
         && ups[GRIP_BEZIER2].off.isNull()
         && userOff().isNull()
         && visible()
         && (color() == Qt::black)
            )
            return;

      xml.stag(QString("SlurSegment no=\"%1\"").arg(no));
      if (!userOff().isNull())
            xml.tag("offset", userOff() / spatium());
      if (!(ups[GRIP_START].off.isNull()))
            xml.tag("o1", ups[GRIP_START].off);
      if (!(ups[GRIP_BEZIER1].off.isNull()))
            xml.tag("o2", ups[GRIP_BEZIER1].off);
      if (!(ups[GRIP_BEZIER2].off.isNull()))
            xml.tag("o3", ups[GRIP_BEZIER2].off);
      if (!(ups[GRIP_END].off.isNull()))
            xml.tag("o4", ups[GRIP_END].off);
      Element::writeProperties(xml);
      xml.etag();
      }
Example #20
0
void Bend::write(Xml& xml) const
      {
      xml.stag("Bend");
      foreach(const PitchValue& v, _points) {
            xml.tagE(QString("point time=\"%1\" pitch=\"%2\" vibrato=\"%3\"")
               .arg(v.time).arg(v.pitch).arg(v.vibrato));
            }
Example #21
0
void Glissando::write(Xml& xml) const
      {
      xml.stag("Glissando");
      if (_showText && !_text.isEmpty())
            xml.tag("text", _text);
      Element::writeProperties(xml);
      xml.etag();
      }
Example #22
0
void Stem::write(Xml& xml) const
      {
      xml.stag("Stem");
      Element::writeProperties(xml);
      if (_userLen != 0.0)
            xml.tag("userLen", _userLen / spatium());
      xml.etag();
      }
Example #23
0
void Harmony::write(Xml& xml) const
      {
      if (!xml.canWrite(this)) return;
      xml.stag("Harmony");
      if (_leftParen)
            xml.tagE("leftParen");
      if (_rootTpc != Tpc::TPC_INVALID || _baseTpc != Tpc::TPC_INVALID) {
            int rRootTpc = _rootTpc;
            int rBaseTpc = _baseTpc;
            if (staff()) {
                  const Interval& interval = staff()->part()->instr()->transpose();
                  if (xml.clipboardmode && !score()->styleB(StyleIdx::concertPitch) && interval.chromatic) {
                        rRootTpc = transposeTpc(_rootTpc, interval, false);
                        rBaseTpc = transposeTpc(_baseTpc, interval, false);
                        }
                  }
            if (rRootTpc != Tpc::TPC_INVALID)
                  xml.tag("root", rRootTpc);
            if (_id > 0)
                  xml.tag("extension", _id);
            if (_textName != "")
                  xml.tag("name", _textName);
            if (rBaseTpc != Tpc::TPC_INVALID)
                  xml.tag("base", rBaseTpc);
            foreach(const HDegree& hd, _degreeList) {
                  HDegreeType tp = hd.type();
                  if (tp == HDegreeType::ADD || tp == HDegreeType::ALTER || tp == HDegreeType::SUBTRACT) {
                        xml.stag("degree");
                        xml.tag("degree-value", hd.value());
                        xml.tag("degree-alter", hd.alter());
                        switch (tp) {
                              case HDegreeType::ADD:
                                    xml.tag("degree-type", "add");
                                    break;
                              case HDegreeType::ALTER:
                                    xml.tag("degree-type", "alter");
                                    break;
                              case HDegreeType::SUBTRACT:
                                    xml.tag("degree-type", "subtract");
                                    break;
                              default:
                                    break;
                              }
                        xml.etag();
                        }
                  }
Example #24
0
void Ottava::write(Xml& xml) const
      {
      xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(id()));
      writeProperty(xml, P_ID::NUMBERS_ONLY);
      xml.tag("subtype", ottavaDefault[int(ottavaType())].name);
      TextLine::writeProperties(xml);
      xml.etag();
      }
Example #25
0
void Groups::write(Xml& xml) const
      {
      xml.stag("Groups");
      for (const GroupNode& n : *this)
            xml.tagE(QString("Node pos=\"%1\" action=\"%3\"")
               .arg(n.pos).arg(n.action));
      xml.etag();
      }
Example #26
0
void Breath::write(Xml& xml) const
      {
      if (!xml.canWrite(this)) return;
      xml.stag("Breath");
      xml.tag("subtype", _breathType);
      Element::writeProperties(xml);
      xml.etag();
      }
Example #27
0
void StringData::write(Xml& xml) const
      {
      xml.stag("StringData");
      xml.tag("frets", _frets);
      foreach(int pitch, stringTable)
            xml.tag("string", pitch);
      xml.etag();
      }
Example #28
0
void Text::write(Xml& xml) const
      {
      if (isEmpty())
            return;
      xml.stag(name());
      writeProperties(xml, true);
      xml.etag();
      }
Example #29
0
void Icon::write(Xml& xml) const
      {
      xml.stag(name());
      xml.tag("subtype", _iconType);
      if (_action)
            xml.tag("action", _action);
      xml.etag();
      }
Example #30
0
void Bracket::write(Xml& xml) const
      {
      switch(subtype()) {
            case BRACKET_AKKOLADE:
                  xml.stag("Bracket type=\"Akkolade\"");
                  break;
            case BRACKET_NORMAL:
                  xml.stag("Bracket");
                  break;
            case NO_BRACKET:
                  break;
            }
      if (_column)
            xml.tag("level", _column);
      Element::writeProperties(xml);
      xml.etag();
      }