Exemplo n.º 1
0
void Hairpin::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      int id = xml.spannerId(this);
      xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(id));
      xml.tag("subtype", int(_hairpinType));
      if (_useTextLine)
            xml.tag("useTextLine", true);
      writeProperty(xml, P_ID::VELO_CHANGE);
      writeProperty(xml, P_ID::HAIRPIN_CIRCLEDTIP);
      writeProperty(xml, P_ID::DYNAMIC_RANGE);
      writeProperty(xml, P_ID::PLACEMENT);
      writeProperty(xml, P_ID::HAIRPIN_HEIGHT);
      writeProperty(xml, P_ID::HAIRPIN_CONT_HEIGHT);
      TextLine::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 2
0
void Lyrics::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag("Lyrics");
      if (_no)
            xml.tag("no", _no);
      if (_syllabic != Syllabic::SINGLE) {
            static const char* sl[] = {
                  "single", "begin", "end", "middle"
                  };
            xml.tag("syllabic", sl[int(_syllabic)]);
            }
      writeProperty(xml, P_ID::LYRIC_TICKS);

      Text::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 3
0
void StaffState::write(Xml& xml) const
      {
      xml.stag(name());
      xml.tag("subtype", int(_staffStateType));
      if (staffStateType() == StaffStateType::INSTRUMENT)
            _instrument->write(xml);
      Element::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 4
0
void Box::writeProperties(Xml& xml) const
      {
      writeProperty(xml, P_ID::BOX_HEIGHT);
      writeProperty(xml, P_ID::BOX_WIDTH);

      if (getProperty(P_ID::TOP_GAP) != propertyDefault(P_ID::TOP_GAP))
            xml.tag("topGap", _topGap / spatium());
      if (getProperty(P_ID::BOTTOM_GAP) != propertyDefault(P_ID::BOTTOM_GAP))
            xml.tag("bottomGap", _bottomGap / spatium());
      writeProperty(xml, P_ID::LEFT_MARGIN);
      writeProperty(xml, P_ID::RIGHT_MARGIN);
      writeProperty(xml, P_ID::TOP_MARGIN);
      writeProperty(xml, P_ID::BOTTOM_MARGIN);

      Element::writeProperties(xml);
      foreach (const Element* el, _el)
            el->write(xml);
      }
Exemplo n.º 5
0
void NamedEventList::write(Xml& xml, const QString& n) const
      {
      xml.stag(QString("%1 name=\"%2\"").arg(n).arg(name));
      if (!descr.isEmpty())
            xml.tag("descr", descr);
      foreach(const Event& e, events)
            e.write(xml);
      xml.etag();
      }
Exemplo n.º 6
0
void Articulation::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag("Articulation");
      if (!_channelName.isEmpty())
            xml.tagE(QString("channel name=\"%1\"").arg(_channelName));
      writeProperty(xml, P_ID::DIRECTION);
      xml.tag("subtype", subtypeName());
      if (_timeStretch != 1.0)
            xml.tag("timeStretch", _timeStretch);
      writeProperty(xml, P_ID::PLAY_ARTICULATION);
      writeProperty(xml, P_ID::ORNAMENT_STYLE);
      Element::writeProperties(xml);
      if (anchorStyle == PropertyStyle::UNSTYLED)
            xml.tag("anchor", int(_anchor));
      xml.etag();
      }
Exemplo n.º 7
0
void Dynamic::write(Xml& xml) const
      {
      xml.stag("Dynamic");
      xml.tag("subtype", dynamicTypeName());
      writeProperty(xml, P_VELOCITY);
      writeProperty(xml, P_DYNAMIC_RANGE);
      Text::writeProperties(xml, dynamicType() == 0);
      xml.etag();
      }
Exemplo n.º 8
0
void Lyrics::write(Xml& xml) const
      {
      xml.stag("Lyrics");
      if (_no)
            xml.tag("no", _no);
      if (_syllabic != SINGLE) {
            static const char* sl[] = {
                  "single", "begin", "end", "middle"
                  };
            xml.tag("syllabic", sl[_syllabic]);
            }
      if (_ticks)
            xml.tag("ticks", _ticks);
      Text::writeProperties(xml);
      if (_verseNumber)
            _verseNumber->write(xml, "Number");
      xml.etag();
      }
Exemplo n.º 9
0
void StaffState::write(Xml& xml) const
      {
      xml.stag(name());
      xml.tag("subtype", _subtype);
      if (subtype() == STAFF_STATE_INSTRUMENT)
            _instrument.write(xml);
      Element::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 10
0
void Trill::write(Xml& xml) const
      {
      xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(id()));
      if (_accidental)
            _accidental->write(xml);
      xml.tag("subtype", subtypeName());
      SLine::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 11
0
void MidiInstrument::write(int level, Xml& xml)
{
    xml.header();
    xml.tag(level, "los version=\"1.0\"");
    level++;
    xml.nput(level, "<MidiInstrument name=\"%s\" panValue=\"%f\"",
            Xml::xmlString(iname()).toLatin1().constData(), m_panValue);

    if (_nullvalue != -1)
    {
        QString nv;
        nv.setNum(_nullvalue);
        xml.nput(" nullparam=\"%s\"", nv.toLatin1().constData());
    }
    xml.put(">");

    // -------------
    // What about Init, Reset, State, and InitScript ?
    // -------------

    level++;
    for (ciPatchGroup g = pg.begin(); g != pg.end(); ++g)
    {
        PatchGroup* pgp = *g;
        const PatchList& pl = pgp->patches;
        xml.tag(level, "PatchGroup name=\"%s\"", Xml::xmlString(pgp->name).toLatin1().constData());
        level++;
        for (ciPatch p = pl.begin(); p != pl.end(); ++p)
            (*p)->write(level, xml);
        level--;
        xml.etag(level, "PatchGroup");
    }
    for (iMidiController ic = _controller->begin(); ic != _controller->end(); ++ic)
        ic->second->write(level, xml);
    for(QHash<int, KeyMap*>::const_iterator km = m_keymaps.begin(); km != m_keymaps.end(); ++km)
    {
        KeyMap *m = km.value();
        m->write(level, xml);
    }
    level--;
    xml.etag(level, "MidiInstrument");
    level--;
    xml.etag(level, "los");
}
Exemplo n.º 12
0
void AudioTrack::writeProperties(int level, Xml& xml) const
{
	Track::writeProperties(level, xml);
	xml.intTag(level, "prefader", prefader());
	xml.intTag(level, "sendMetronome", sendMetronome());
	xml.intTag(level, "automation", int(automationType()));
	if (hasAuxSend())
	{
		QHashIterator<qint64, AuxInfo> iter(_auxSend);
		while (iter.hasNext())
		{
			iter.next();
			Track* t = song->findTrackByIdAndType(iter.key(), Track::AUDIO_AUX);
			//Write it out only if the AUX track still exists
			if(t)
			{
				bool pre = iter.value().first;
				double val = iter.value().second;
				QString s("<auxSend trackId=\"%1\" pre=\"%2\">%3</auxSend>\n");
				xml.nput(level, s.arg(iter.key()).arg(pre).arg(val).toAscii().constData());
			}
		}
	}
    if (_wantsAutomation == false)
    {
        // _wantsAutomation is only set on fake midi automation tracks. on those, we don't need to save the plugins (synth) config
        for (ciPluginI ip = _efxPipe->begin(); ip != _efxPipe->end(); ++ip)
        {
            if (*ip)
                (*ip)->writeConfiguration(level, xml);
        }
    }
	for (ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl)
	{
		const CtrlList* cl = icl->second;

		QString s= QString("controller id=\"%1\" cur=\"%2\"").arg(cl->id()).arg(cl->curVal()).toAscii().constData();
		s += QString(" color=\"%1\" visible=\"%2\"").arg(cl->color().name()).arg(cl->isVisible());
		xml.tag(level++, s.toAscii().constData());
		int i = 0;
		for (ciCtrl ic = cl->begin(); ic != cl->end(); ++ic)
		{
			QString s("%1 %2, ");
			xml.nput(level, s.arg(ic->second.getFrame()).arg(ic->second.val).toAscii().constData());
			++i;
			if (i >= 4)
			{
				xml.put(level, "");
				i = 0;
			}
		}
		if (i)
			xml.put(level, "");
        xml.etag(--level, "controller");
	}
}
Exemplo n.º 13
0
void writeShortCuts(int level, Xml& xml)
{
	xml.tag(level++, "shortcuts");
	for (int i = 0; i < SHRT_NUM_OF_ELEMENTS; i++)
	{
		if (shortcuts[i].xml != NULL && shortcuts[i].type != INVIS_SHRT) //Avoid nullptr & hardcoded shortcuts
			xml.intTag(level, shortcuts[i].xml, shortcuts[i].key);
	}
	xml.etag(level, "shortcuts");
}
Exemplo n.º 14
0
void ElementLayout::writeProperties(Xml& xml, const ElementLayout& l) const
      {
      if ((l._align & ALIGN_HMASK) != (_align & ALIGN_HMASK)) {
            const char* p;
            if (_align & ALIGN_HCENTER)
                  p = "center";
            else if (_align & ALIGN_RIGHT)
                  p = "right";
            else
                  p = "left";
            xml.tag("halign", p);
            }

      if ((l._align & ALIGN_VMASK) != (_align & ALIGN_VMASK)) {
            const char* p;
            if (_align & ALIGN_BOTTOM)
                  p = "bottom";
            else if (_align & ALIGN_VCENTER)
                  p = "center";
            else if (_align & ALIGN_BASELINE)
                  p = "baseline";
            else
                  p = "top";
            xml.tag("valign", p);
            }

      if (l._offset != _offset) {
            QPointF pt(_offset);
            if (offsetType() == OffsetType::ABS)
                  pt *= INCH;
            xml.tag("xoffset", pt.x());         // save in spatium or metric mm
            xml.tag("yoffset", pt.y());
            }

      if (_offsetType != l._offsetType) {
            const char* p = 0;
            switch(_offsetType) {
                  case OffsetType::SPATIUM: p = "spatium"; break;
                  case OffsetType::ABS:     p = "absolute"; break;
                  }
            xml.tag("offsetType", p);
            }
      }
Exemplo n.º 15
0
void Breath::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag("Breath");
      xml.tag("subtype", _breathType);
      writeProperty(xml, P_ID::PAUSE);
      Element::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 16
0
void Ottava::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(xml.spannerId(this)));
      writeProperty(xml, P_ID::NUMBERS_ONLY);
      xml.tag("subtype", ottavaDefault[int(ottavaType())].name);
      TextLine::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 17
0
void Trill::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(xml.spannerId(this)));
      xml.tag("subtype", trillTypeName());
      SLine::writeProperties(xml);
      if (_accidental)
            _accidental->write(xml);
      xml.etag();
      }
Exemplo n.º 18
0
void ChordLine::write(Xml& xml) const
      {
      xml.stag(name());
      xml.tag("subtype", int(_chordLineType));
      xml.tag("straight", _straight, false);
      xml.tag("lengthX", _lengthX, 0.0);
      xml.tag("lengthY", _lengthY, 0.0);
      Element::writeProperties(xml);
      if (modified) {
            int n = path.elementCount();
            xml.stag("Path");
            for (int i = 0; i < n; ++i) {
                  const QPainterPath::Element& e = path.elementAt(i);
                  xml.tagE(QString("Element type=\"%1\" x=\"%2\" y=\"%3\"")
                     .arg(int(e.type)).arg(e.x).arg(e.y));
                  }
            xml.etag();
            }
      xml.etag();
      }
Exemplo n.º 19
0
void Dynamic::write(Xml& xml) const
      {
      if (!xml.canWrite(this))
            return;
      xml.stag("Dynamic");
      xml.tag("subtype", dynamicTypeName());
      writeProperty(xml, P_ID::VELOCITY);
      writeProperty(xml, P_ID::DYNAMIC_RANGE);
      Text::writeProperties(xml, dynamicType() == Type::OTHER);
      xml.etag();
      }
Exemplo n.º 20
0
void KeySig::write(Xml& xml) const
      {
      xml.stag(name());
      Element::writeProperties(xml);
      if (_sig.custom()) {
            xml.tag("custom", 1);
            for (const KeySym& ks : _sig.keySymbols()) {
                  xml.stag("KeySym");
                  xml.tag("sym", Sym::id2name(ks.sym));
                  xml.tag("pos", ks.spos);
                  xml.etag();
                  }
            }
      else {
            xml.tag("accidental", int(_sig.key()));
            }
      if (!_showCourtesy)
            xml.tag("showCourtesySig", _showCourtesy);
      xml.etag();
      }
Exemplo n.º 21
0
void Articulation::write(Xml& xml) const
      {
      xml.stag("Articulation");
      if (!_channelName.isEmpty())
            xml.tagE(QString("channel name=\"%1\"").arg(_channelName));
      switch(_direction) {
            case MScore::UP:
                  xml.tag("direction", QVariant("up"));
                  break;
            case MScore::DOWN:
                  xml.tag("direction", QVariant("down"));
                  break;
            case MScore::AUTO:
                  break;
            }
      xml.tag("subtype", subtypeName());
      Element::writeProperties(xml);
      if (_anchor != score()->style()->articulationAnchor(subtype()))
            xml.tag("anchor", int(_anchor));
      xml.etag();
      }
Exemplo n.º 22
0
void Arpeggio::write(Xml& xml) const
      {
      xml.stag("Arpeggio");
      Element::writeProperties(xml);
      if (_userLen1.val() != 0.0)
            xml.sTag("userLen1", _userLen1);
      if (_userLen2.val() != 0.0)
            xml.sTag("userLen2", _userLen2);
      if (_span != 1)
            xml.tag("span", _span);
      xml.etag();
      }
Exemplo n.º 23
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();
            }
      }
Exemplo n.º 24
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())
            return;

      xml.stag(QString("SlurSegment no=\"%1\"").arg(no));
      if (!visible())
            xml.tag("visible", visible());
      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);
      xml.etag();
      }
Exemplo n.º 25
0
void StaffTypeTablature::write(Xml& xml, int idx) const
      {
      xml.stag(QString("StaffType idx=\"%1\" group=\"%2\"").arg(idx).arg(groupName()));
      StaffType::writeProperties(xml);
      xml.tag("durations",        _genDurations);
      xml.tag("durationFontName", _durationFontName);
      xml.tag("durationFontSize", _durationFontSize);
      xml.tag("durationFontY",    _durationFontUserY);
      xml.tag("fretFontName",     _fretFontName);
      xml.tag("fretFontSize",     _fretFontSize);
      xml.tag("fretFontY",        _fretFontUserY);
      xml.tag("linesThrough",     _linesThrough);
      xml.tag("onLines",          _onLines);
      xml.tag("timesig",          _genTimesig);
      xml.tag("upsideDown",       _upsideDown);
      xml.tag("useNumbers",       _useNumbers);
      xml.etag();
      }
Exemplo n.º 26
0
void BarLine::write(Xml& xml) const
      {
      xml.stag("BarLine");
      xml.tag("subtype", barLineTypeName());
      if (_customSubtype)
            xml.tag("customSubtype", _customSubtype);
      // if any span value is different from staff's, output all values
      if (  (staff() && (  _span != staff()->barLineSpan()
                           || _spanFrom != staff()->barLineFrom()
                           || _spanTo != staff()->barLineTo()
                         )
             )
            || !staff())            // (palette bar lines have no staff: output all values)
            xml.tag(QString("span from=\"%1\" to=\"%2\"").arg(_spanFrom).arg(_spanTo), _span);
      // if no custom value, output _span only (as in previous code)
      else
            xml.tag("span", _span);
      foreach(const Element* e, _el)
            e->write(xml);
      Element::writeProperties(xml);
      xml.etag();
      }
Exemplo n.º 27
0
void Lyrics::write(Xml& xml) const
      {
      if(!xml.canWrite(this)) return;
      xml.stag("Lyrics");
      if (_no)
            xml.tag("no", _no);
      if (_syllabic != Syllabic::SINGLE) {
            static const char* sl[] = {
                  "single", "begin", "end", "middle"
                  };
            xml.tag("syllabic", sl[int(_syllabic)]);
            }
      if (_ticks)
            xml.tag("ticks", _ticks);
      Text::writeProperties(xml);
      if (_verseNumber) {
            xml.stag("Number");
            _verseNumber->writeProperties(xml);
            xml.etag();
            }
      xml.etag();
      }
Exemplo n.º 28
0
void MidiInstrument::writeDrummaps(int level, Xml& xml) const
{
  xml.tag(level++, "Drummaps");

  for (std::list<patch_drummap_mapping_t>::const_iterator it=patch_drummap_mapping.begin();
       it!=patch_drummap_mapping.end(); it++)
  {
    xml.tag(level++, "entry");

    const patch_collection_t* ap = &it->affected_patches;
    QString tmp="<patch_collection ";
    if (ap->first_program==ap->last_program)
      tmp+="prog=\""+QString::number(ap->first_program)+"\" ";
    else if (! (ap->first_program==0 && ap->last_program>=127))
      tmp+="prog=\""+QString::number(ap->first_program)+"-"+QString::number(ap->last_program)+"\" ";

    if (ap->first_lbank==ap->last_lbank)
      tmp+="lbank=\""+QString::number(ap->first_lbank)+"\" ";
    else if (! (ap->first_lbank==0 && ap->last_lbank>=127))
      tmp+="lbank=\""+QString::number(ap->first_lbank)+"-"+QString::number(ap->last_lbank)+"\" ";

    if (ap->first_hbank==ap->last_hbank)
      tmp+="hbank=\""+QString::number(ap->first_hbank)+"\" ";
    else if (! (ap->first_hbank==0 && ap->last_hbank>=127))
      tmp+="hbank=\""+QString::number(ap->first_hbank)+"-"+QString::number(ap->last_hbank)+"\" ";

    tmp+="/>\n";

    xml.nput(level, tmp.toLatin1().data());

    write_new_style_drummap(level, xml, "drummap", it->drummap);

    xml.etag(--level, "entry");
  }

  xml.etag(--level, "Drummaps");
}
Exemplo n.º 29
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 (!(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();
      }
Exemplo n.º 30
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();
                        }
                  }