Make it possible to record elements written to MSCX
This commit is contained in:
parent
e6f06d225a
commit
c95dfd5a40
67 changed files with 113 additions and 76 deletions
|
@ -187,7 +187,7 @@ void Accidental::read(XmlReader& e)
|
|||
|
||||
void Accidental::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
writeProperty(xml, Pid::ACCIDENTAL_BRACKET);
|
||||
writeProperty(xml, Pid::ROLE);
|
||||
writeProperty(xml, Pid::SMALL);
|
||||
|
|
|
@ -182,7 +182,7 @@ void Ambitus::setBottomTpc(int val)
|
|||
|
||||
void Ambitus::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("Ambitus");
|
||||
xml.stag(this);
|
||||
xml.tag(Pid::HEAD_GROUP, int(_noteHeadGroup), int(NOTEHEADGROUP_DEFAULT));
|
||||
xml.tag(Pid::HEAD_TYPE, int(_noteHeadType), int(NOTEHEADTYPE_DEFAULT));
|
||||
xml.tag(Pid::MIRROR_HEAD,int(_dir), int(DIR_DEFAULT));
|
||||
|
|
|
@ -56,7 +56,7 @@ void Arpeggio::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("Arpeggio");
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
xml.tag("subtype", int(_arpeggioType));
|
||||
if (_userLen1 != 0.0)
|
||||
|
|
|
@ -143,7 +143,7 @@ void Articulation::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("Articulation");
|
||||
xml.stag(this);
|
||||
if (!_channelName.isEmpty())
|
||||
xml.tagE(QString("channel name=\"%1\"").arg(_channelName));
|
||||
writeProperty(xml, Pid::DIRECTION);
|
||||
|
|
|
@ -357,7 +357,7 @@ noteList BagpipeEmbellishment::getNoteList() const
|
|||
|
||||
void BagpipeEmbellishment::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", _embelType);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ void BarLine::drawEditMode(QPainter* p, EditData& ed)
|
|||
|
||||
void BarLine::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("BarLine");
|
||||
xml.stag(this);
|
||||
|
||||
writeProperty(xml, Pid::BARLINE_TYPE);
|
||||
writeProperty(xml, Pid::BARLINE_SPAN);
|
||||
|
|
|
@ -1989,7 +1989,7 @@ void Beam::write(XmlWriter& xml) const
|
|||
{
|
||||
if (_elements.empty())
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
|
||||
writeProperty(xml, Pid::STEM_DIRECTION);
|
||||
|
|
|
@ -280,7 +280,7 @@ void Bend::draw(QPainter* painter) const
|
|||
|
||||
void Bend::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("Bend");
|
||||
xml.stag(this);
|
||||
for (const PitchValue& v : _points) {
|
||||
xml.tagE(QString("point time=\"%1\" pitch=\"%2\" vibrato=\"%3\"")
|
||||
.arg(v.time).arg(v.pitch).arg(v.vibrato));
|
||||
|
|
|
@ -189,7 +189,7 @@ void Box::updateGrips(EditData& ed) const
|
|||
|
||||
void Box::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -446,16 +446,16 @@ void Bracket::write(XmlWriter& xml) const
|
|||
{
|
||||
switch (_bi->bracketType()) {
|
||||
case BracketType::BRACE:
|
||||
xml.stag("Bracket type=\"Brace\"");
|
||||
xml.stag(this, "type=\"Brace\"");
|
||||
break;
|
||||
case BracketType::NORMAL:
|
||||
xml.stag("Bracket");
|
||||
xml.stag(this);
|
||||
break;
|
||||
case BracketType::SQUARE:
|
||||
xml.stag("Bracket type=\"Square\"");
|
||||
xml.stag(this, "type=\"Square\"");
|
||||
break;
|
||||
case BracketType::LINE:
|
||||
xml.stag("Bracket type=\"Line\"");
|
||||
xml.stag(this, "type=\"Line\"");
|
||||
break;
|
||||
case BracketType::NO_BRACKET:
|
||||
break;
|
||||
|
|
|
@ -76,7 +76,7 @@ void Breath::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("Breath");
|
||||
xml.stag(this);
|
||||
writeProperty(xml, Pid::SYMBOL);
|
||||
writeProperty(xml, Pid::PAUSE);
|
||||
Element::writeProperties(xml);
|
||||
|
|
|
@ -908,7 +908,7 @@ void Chord::write(XmlWriter& xml) const
|
|||
c->write(xml);
|
||||
}
|
||||
writeBeam(xml);
|
||||
xml.stag("Chord");
|
||||
xml.stag(this);
|
||||
ChordRest::writeProperties(xml);
|
||||
for (const Articulation* a : _articulations)
|
||||
a->write(xml);
|
||||
|
|
|
@ -207,7 +207,7 @@ void ChordLine::read(XmlReader& e)
|
|||
|
||||
void ChordLine::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", int(_chordLineType));
|
||||
xml.tag("straight", _straight, false);
|
||||
xml.tag("lengthX", _lengthX, 0.0);
|
||||
|
|
|
@ -310,7 +310,7 @@ void Clef::read(XmlReader& e)
|
|||
|
||||
void Clef::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
if (_clefTypes._concertClef != ClefType::INVALID)
|
||||
xml.tag("concertClefType", ClefInfo::tag(_clefTypes._concertClef));
|
||||
if (_clefTypes._transposingClef != ClefType::INVALID)
|
||||
|
|
|
@ -122,7 +122,7 @@ void Dynamic::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("Dynamic");
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", dynamicTypeName());
|
||||
writeProperty(xml, Pid::VELOCITY);
|
||||
writeProperty(xml, Pid::DYNAMIC_RANGE);
|
||||
|
|
|
@ -668,7 +668,7 @@ bool Element::readProperties(XmlReader& e)
|
|||
|
||||
void Element::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ void Fermata::write(XmlWriter& xml) const
|
|||
qDebug("%s not written", name());
|
||||
return;
|
||||
}
|
||||
xml.stag("Fermata");
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", Sym::id2name(_symId));
|
||||
writeProperty(xml, Pid::TIME_STRETCH);
|
||||
writeProperty(xml, Pid::PLAY);
|
||||
|
|
|
@ -405,7 +405,7 @@ QString FiguredBassItem::normalizedText() const
|
|||
|
||||
void FiguredBassItem::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("FiguredBassItem");
|
||||
xml.stag("FiguredBassItem", this);
|
||||
xml.tagE(QString("brackets b0=\"%1\" b1=\"%2\" b2=\"%3\" b3=\"%4\" b4=\"%5\"")
|
||||
.arg(int(parenth[0])) .arg(int(parenth[1])) .arg(int(parenth[2])) .arg(int(parenth[3])) .arg(int(parenth[4])) );
|
||||
if (_prefix != Modifier::NONE)
|
||||
|
@ -1016,7 +1016,7 @@ void FiguredBass::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("FiguredBass");
|
||||
xml.stag(this);
|
||||
if(!onNote())
|
||||
xml.tag("onNote", onNote());
|
||||
if (ticks() > 0)
|
||||
|
|
|
@ -394,7 +394,7 @@ void FretDiagram::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("FretDiagram");
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
|
||||
writeProperty(xml, Pid::FRET_STRINGS);
|
||||
|
|
|
@ -370,7 +370,7 @@ void Glissando::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
if (_showText && !_text.isEmpty())
|
||||
xml.tag("text", _text);
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ void Hairpin::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", int(_hairpinType));
|
||||
writeProperty(xml, Pid::VELO_CHANGE);
|
||||
writeProperty(xml, Pid::HAIRPIN_CIRCLEDTIP);
|
||||
|
|
|
@ -200,7 +200,7 @@ void Harmony::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("Harmony");
|
||||
xml.stag(this);
|
||||
if (_leftParen)
|
||||
xml.tagE("leftParen");
|
||||
if (_rootTpc != Tpc::TPC_INVALID || _baseTpc != Tpc::TPC_INVALID) {
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Ms {
|
|||
|
||||
void Icon::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", int(_iconType));
|
||||
if (!_action.isEmpty())
|
||||
xml.tag("action", _action.data());
|
||||
|
|
|
@ -214,7 +214,7 @@ void Image::write(XmlWriter& xml) const
|
|||
if (relativeFilePath.isEmpty())
|
||||
relativeFilePath = _linkPath;
|
||||
|
||||
xml.stag("Image");
|
||||
xml.stag(this);
|
||||
BSymbol::writeProperties(xml);
|
||||
// keep old "path" tag, for backward compatibility and because it is used elsewhere
|
||||
// (for instance by Box:read(), Measure:read(), Note:read(), ...)
|
||||
|
|
|
@ -73,7 +73,7 @@ void InstrumentChange::setInstrument(const Instrument& i)
|
|||
|
||||
void InstrumentChange::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
_instrument->write(xml, part());
|
||||
TextBase::writeProperties(xml);
|
||||
xml.etag();
|
||||
|
|
|
@ -131,7 +131,7 @@ void Jump::read(XmlReader& e)
|
|||
|
||||
void Jump::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
TextBase::writeProperties(xml);
|
||||
xml.tag("jumpTo", _jumpTo);
|
||||
xml.tag("playUntil", _playUntil);
|
||||
|
|
|
@ -329,7 +329,7 @@ void KeySig::setKey(Key key)
|
|||
|
||||
void KeySig::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
if (_sig.isAtonal()) {
|
||||
xml.tag("custom", 1);
|
||||
|
|
|
@ -48,7 +48,7 @@ LayoutBreak::LayoutBreak(const LayoutBreak& lb)
|
|||
|
||||
void LayoutBreak::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
|
||||
writeProperty(xml, Pid::LAYOUT_BREAK);
|
||||
|
|
|
@ -87,7 +87,7 @@ void LetRing::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
|
||||
for (const StyledProperty& spp : *styledProperties()) {
|
||||
if (!isStyled(spp.pid))
|
||||
|
|
|
@ -1040,7 +1040,7 @@ void SLine::writeProperties(XmlWriter& xml) const
|
|||
//
|
||||
qreal _spatium = spatium();
|
||||
for (const SpannerSegment* seg : spannerSegments()) {
|
||||
xml.stag("Segment");
|
||||
xml.stag("Segment", seg);
|
||||
xml.tag("subtype", int(seg->spannerSegmentType()));
|
||||
xml.tag("offset", seg->offset() / _spatium);
|
||||
xml.tag("off2", seg->userOff2() / _spatium);
|
||||
|
@ -1128,7 +1128,7 @@ const QRectF& SLine::bbox() const
|
|||
|
||||
void SLine::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
SLine::writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void Lyrics::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag("Lyrics");
|
||||
xml.stag(this);
|
||||
writeProperty(xml, Pid::VERSE);
|
||||
if (_syllabic != Syllabic::SINGLE) {
|
||||
static const char* sl[] = {
|
||||
|
|
|
@ -204,7 +204,7 @@ void Marker::read(XmlReader& e)
|
|||
|
||||
void Marker::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
TextBase::writeProperties(xml);
|
||||
xml.tag("label", _label);
|
||||
xml.etag();
|
||||
|
|
|
@ -1760,10 +1760,10 @@ void Measure::write(XmlWriter& xml, int staff, bool writeSystemElements, bool fo
|
|||
}
|
||||
if (_len != _timesig) {
|
||||
// this is an irregular measure
|
||||
xml.stag(QString("Measure len=\"%1/%2\"").arg(_len.numerator()).arg(_len.denominator()));
|
||||
xml.stag(this, QString("len=\"%1/%2\"").arg(_len.numerator()).arg(_len.denominator()));
|
||||
}
|
||||
else
|
||||
xml.stag("Measure");
|
||||
xml.stag(this);
|
||||
|
||||
xml.setCurTick(tick());
|
||||
xml.setCurTrack(staff * VOICES);
|
||||
|
@ -1784,7 +1784,7 @@ void Measure::write(XmlWriter& xml, int staff, bool writeSystemElements, bool fo
|
|||
qreal _spatium = spatium();
|
||||
MStaff* mstaff = _mstaves[staff];
|
||||
if (mstaff->noText() && !mstaff->noText()->generated()) {
|
||||
xml.stag("MeasureNumber");
|
||||
xml.stag("MeasureNumber", mstaff->noText());
|
||||
mstaff->noText()->writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -1177,7 +1177,7 @@ void Note::draw(QPainter* painter) const
|
|||
|
||||
void Note::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("Note");
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
|
||||
if (_accidental)
|
||||
|
|
|
@ -255,7 +255,7 @@ void Ottava::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", ottavaDefault[int(ottavaType())].name);
|
||||
// for (const StyledProperty& spp : *styledProperties())
|
||||
// writeProperty(xml, spp.pid);
|
||||
|
|
|
@ -418,7 +418,7 @@ bool Page::isOdd() const
|
|||
|
||||
void Page::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("Page");
|
||||
xml.stag(this);
|
||||
foreach(System* system, _systems) {
|
||||
system->write(xml);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void PalmMute::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
|
||||
for (const StyledProperty& spp : *styledProperties())
|
||||
writeProperty(xml, spp.pid);
|
||||
|
|
|
@ -109,7 +109,7 @@ void Part::read(XmlReader& e)
|
|||
|
||||
void Part::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("Part");
|
||||
xml.stag(this);
|
||||
foreach(const Staff* staff, _staves)
|
||||
staff->write(xml);
|
||||
if (!_show)
|
||||
|
|
|
@ -122,7 +122,7 @@ void Pedal::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
|
||||
for (auto i : {
|
||||
Pid::END_HOOK_TYPE,
|
||||
|
|
|
@ -850,7 +850,7 @@ void Rest::write(XmlWriter& xml) const
|
|||
if (_gap)
|
||||
return;
|
||||
writeBeam(xml);
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
ChordRest::writeProperties(xml);
|
||||
el().write(xml);
|
||||
bool write_dots = false;
|
||||
|
|
|
@ -102,7 +102,7 @@ void Score::writeMovement(XmlWriter& xml, bool selectionOnly)
|
|||
p->setShow(false);
|
||||
}
|
||||
|
||||
xml.stag("Score");
|
||||
xml.stag(this);
|
||||
if (excerpt()) {
|
||||
Excerpt* e = excerpt();
|
||||
QMultiMap<int, int> trackList = e->tracks();
|
||||
|
@ -208,7 +208,7 @@ void Score::writeMovement(XmlWriter& xml, bool selectionOnly)
|
|||
xml.setTrackDiff(-staffStart * VOICES);
|
||||
if (measureStart) {
|
||||
for (int staffIdx = staffStart; staffIdx < staffEnd; ++staffIdx) {
|
||||
xml.stag(QString("Staff id=\"%1\"").arg(staffIdx + 1 - staffStart));
|
||||
xml.stag(staff(staffIdx), QString("id=\"%1\"").arg(staffIdx + 1 - staffStart));
|
||||
xml.setCurTick(measureStart->tick());
|
||||
xml.setTickDiff(xml.curTick());
|
||||
xml.setCurTrack(staffIdx * VOICES);
|
||||
|
|
|
@ -808,7 +808,7 @@ void Segment::write(XmlWriter& xml) const
|
|||
setWritten(true);
|
||||
if (_extraLeadingSpace.isZero())
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("leadingSpace", _extraLeadingSpace.val());
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -1003,7 +1003,7 @@ void Slur::write(XmlWriter& xml) const
|
|||
}
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
SlurTie::writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ void SlurTieSegment::writeSlur(XmlWriter& xml, int no) const
|
|||
if (autoplace() && visible() && (color() == Qt::black))
|
||||
return;
|
||||
|
||||
xml.stag(QString("%1 no=\"%2\"").arg(name()).arg(no));
|
||||
xml.stag(this, QString("no=\"%1\"").arg(no));
|
||||
|
||||
qreal _spatium = spatium();
|
||||
xml.tag("o1", ups(Grip::START).off / _spatium);
|
||||
|
|
|
@ -176,7 +176,7 @@ void Spacer::updateGrips(EditData& ed) const
|
|||
|
||||
void Spacer::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", int(_spacerType));
|
||||
Element::writeProperties(xml);
|
||||
xml.tag("space", _gap / spatium());
|
||||
|
|
|
@ -576,7 +576,7 @@ int Staff::currentKeyTick(int tick) const
|
|||
void Staff::write(XmlWriter& xml) const
|
||||
{
|
||||
int idx = this->idx();
|
||||
xml.stag(QString("Staff id=\"%1\"").arg(idx + 1));
|
||||
xml.stag(this, QString("id=\"%1\"").arg(idx + 1));
|
||||
if (links()) {
|
||||
Score* s = masterScore();
|
||||
for (auto le : *links()) {
|
||||
|
|
|
@ -49,7 +49,7 @@ StaffState::~StaffState()
|
|||
|
||||
void StaffState::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", int(_staffStateType));
|
||||
if (staffStateType() == StaffStateType::INSTRUMENT)
|
||||
_instrument->write(xml, nullptr);
|
||||
|
|
|
@ -37,7 +37,7 @@ void StaffTextBase::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
|
||||
for (ChannelActions s : _channelActions) {
|
||||
int channel = s.channel;
|
||||
|
|
|
@ -42,7 +42,7 @@ StaffTypeChange::StaffTypeChange(const StaffTypeChange& lb)
|
|||
|
||||
void StaffTypeChange::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
if (_staffType)
|
||||
_staffType->write(xml);
|
||||
Element::writeProperties(xml);
|
||||
|
|
|
@ -212,7 +212,7 @@ void Stem::draw(QPainter* painter) const
|
|||
|
||||
void Stem::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("Stem");
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
writeProperty(xml, Pid::USER_LEN);
|
||||
writeProperty(xml, Pid::LINE_WIDTH);
|
||||
|
|
|
@ -97,7 +97,7 @@ void Symbol::draw(QPainter* p) const
|
|||
|
||||
void Symbol::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("name", Sym::id2name(_sym));
|
||||
if (_scoreFont)
|
||||
xml.tag("font", _scoreFont->name());
|
||||
|
@ -199,7 +199,7 @@ void FSymbol::draw(QPainter* painter) const
|
|||
|
||||
void FSymbol::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("font", _font.family());
|
||||
xml.tag("fontsize", _font.pointSizeF());
|
||||
xml.tag("code", _code);
|
||||
|
|
|
@ -984,7 +984,7 @@ qreal System::staffCanvasYpage(int staffIdx) const
|
|||
|
||||
void System::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("System");
|
||||
xml.stag(this);
|
||||
if (_systemDividerLeft && _systemDividerLeft->isUserModified())
|
||||
_systemDividerLeft->write(xml);
|
||||
if (_systemDividerRight && _systemDividerRight->isUserModified())
|
||||
|
|
|
@ -87,9 +87,9 @@ QRectF SystemDivider::drag(EditData& ed)
|
|||
void SystemDivider::write(XmlWriter& xml) const
|
||||
{
|
||||
if (dividerType() == SystemDivider::Type::LEFT)
|
||||
xml.stag(QString("SystemDivider type=\"left\""));
|
||||
xml.stag(this, "type=\"left\"");
|
||||
else
|
||||
xml.stag(QString("SystemDivider type=\"right\""));
|
||||
xml.stag(this, "type=\"right\"");
|
||||
writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ TempoText::TempoText(Score* s)
|
|||
|
||||
void TempoText::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("tempo", _tempo);
|
||||
if (_followText)
|
||||
xml.tag("followText", _followText);
|
||||
|
|
|
@ -1649,7 +1649,7 @@ void TextBase::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
writeProperties(xml, true, true);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ void TBox::layout()
|
|||
|
||||
void TBox::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
Box::writeProperties(xml);
|
||||
_text->write(xml);
|
||||
xml.etag();
|
||||
|
|
|
@ -395,7 +395,7 @@ void TextLineBase::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -519,7 +519,7 @@ Tie::Tie(Score* s)
|
|||
|
||||
void Tie::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
SlurTie::writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ void TimeSig::setDenominatorString(const QString& a)
|
|||
|
||||
void TimeSig::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("TimeSig");
|
||||
xml.stag(this);
|
||||
writeProperty(xml, Pid::TIMESIG_TYPE);
|
||||
Element::writeProperties(xml);
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ void Tremolo::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", tremoloTypeName());
|
||||
Element::writeProperties(xml);
|
||||
xml.etag();
|
||||
|
|
|
@ -86,7 +86,7 @@ void TremoloBar::draw(QPainter* painter) const
|
|||
|
||||
void TremoloBar::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag("TremoloBar");
|
||||
xml.stag(this);
|
||||
writeProperty(xml, Pid::MAG);
|
||||
writeProperty(xml, Pid::LINE_WIDTH);
|
||||
writeProperty(xml, Pid::PLAY);
|
||||
|
|
|
@ -307,7 +307,7 @@ void Trill::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", trillTypeName());
|
||||
writeProperty(xml, Pid::PLAY);
|
||||
writeProperty(xml, Pid::ORNAMENT_STYLE);
|
||||
|
|
|
@ -707,7 +707,7 @@ void Tuplet::scanElements(void* data, void (*func)(void*, Element*), bool all)
|
|||
|
||||
void Tuplet::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
Element::writeProperties(xml);
|
||||
|
||||
writeProperty(xml, Pid::DIRECTION);
|
||||
|
@ -722,7 +722,7 @@ void Tuplet::write(XmlWriter& xml) const
|
|||
xml.tag("baseNote", _baseLen.name());
|
||||
|
||||
if (_number) {
|
||||
xml.stag("Number");
|
||||
xml.stag("Number", _number);
|
||||
_number->writeProperties(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ void Vibrato::write(XmlWriter& xml) const
|
|||
{
|
||||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
xml.tag("subtype", vibratoTypeName());
|
||||
writeProperty(xml, Pid::PLAY);
|
||||
SLine::writeProperties(xml);
|
||||
|
|
|
@ -151,7 +151,7 @@ void Volta::read(XmlReader& e)
|
|||
|
||||
void Volta::write(XmlWriter& xml) const
|
||||
{
|
||||
xml.stag(name());
|
||||
xml.stag(this);
|
||||
TextLineBase::writeProperties(xml);
|
||||
QString s;
|
||||
for (int i : _endings) {
|
||||
|
|
|
@ -222,6 +222,9 @@ class XmlWriter : public QTextStream {
|
|||
LinksIndexer _linksIndexer;
|
||||
QMap<int, int> _lidLocalIndices;
|
||||
|
||||
std::vector<std::pair<const ScoreElement*, QString>> _elements;
|
||||
bool _recordElements = false;
|
||||
|
||||
void putLevel();
|
||||
|
||||
public:
|
||||
|
@ -262,6 +265,9 @@ class XmlWriter : public QTextStream {
|
|||
void setLidLocalIndex(int lid, int localIndex) { _lidLocalIndices.insert(lid, localIndex); }
|
||||
int lidLocalIndex(int lid) const { return _lidLocalIndices[lid]; }
|
||||
|
||||
const std::vector<std::pair<const ScoreElement*, QString>>& elements() const { return _elements; }
|
||||
void setRecordElements(bool record) { _recordElements = record; }
|
||||
|
||||
void sTag(const char* name, Spatium sp) { XmlWriter::tag(name, QVariant(sp.val())); }
|
||||
void pTag(const char* name, PlaceText);
|
||||
|
||||
|
@ -270,6 +276,9 @@ class XmlWriter : public QTextStream {
|
|||
void stag(const QString&);
|
||||
void etag();
|
||||
|
||||
void stag(const ScoreElement* se, const QString& attributes = QString());
|
||||
void stag(const QString& name, const ScoreElement* se, const QString& attributes = QString());
|
||||
|
||||
void tagE(const QString&);
|
||||
void tagE(const char* format, ...);
|
||||
void ntag(const char* name);
|
||||
|
|
|
@ -93,6 +93,34 @@ void XmlWriter::stag(const QString& s)
|
|||
stack.append(s.split(' ')[0]);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// stag
|
||||
// <mops attribute="value">
|
||||
//---------------------------------------------------------
|
||||
|
||||
void XmlWriter::stag(const ScoreElement* se, const QString& attributes)
|
||||
{
|
||||
stag(se->name(), se, attributes);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// stag
|
||||
// <mops attribute="value">
|
||||
//---------------------------------------------------------
|
||||
|
||||
void XmlWriter::stag(const QString& name, const ScoreElement* se, const QString& attributes)
|
||||
{
|
||||
putLevel();
|
||||
*this << '<' << name;
|
||||
if (!attributes.isEmpty())
|
||||
*this << ' ' << attributes;
|
||||
*this << '>' << endl;
|
||||
stack.append(name);
|
||||
|
||||
if (_recordElements)
|
||||
_elements.emplace_back(se, name);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// etag
|
||||
// </mops>
|
||||
|
|
Loading…
Reference in a new issue