StaffText::StaffText(Score* s) : Text(s) { setSubtype(TEXT_STAFF); setTextStyle(TEXT_STYLE_STAFF); _setAeolusStops = false; clearAeolusStops(); }
void StaffTextBase::read(XmlReader& e) { for (int voice = 0; voice < VOICES; ++voice) _channelNames[voice].clear(); clearAeolusStops(); while (e.readNextStartElement()) { if (!readProperties(e)) e.unknown(); } }
StaffText::StaffText(Score* s) : Text(s) { setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE | ElementFlag::ON_STAFF); setTextStyleType(TextStyleType::STAFF); _setAeolusStops = false; _swing = false; clearAeolusStops(); setSwingParameters(MScore::division / 2, 60); }
void StaffText::read(XmlReader* r) { for (int voice = 0; voice < VOICES; ++voice) _channelNames[voice].clear(); clearAeolusStops(); while (r->readElement()) { MString8 tag = r->tag(); #if 0 if (tag == "MidiAction") { int channel = e.attribute("channel", 0).toInt(); QString name = e.attribute("name"); bool found = false; int n = _channelActions.size(); for (int i = 0; i < n; ++i) { ChannelActions* a = &_channelActions[i]; if (a->channel == channel) { a->midiActionNames.append(name); found = true; break; } } if (!found) { ChannelActions a; a.channel = channel; a.midiActionNames.append(name); _channelActions.append(a); } } else if (tag == "channelSwitch" || tag == "articulationChange") { int voice = e.attribute("voice", "-1").toInt(); if (voice >= 0 && voice < VOICES) _channelNames[voice] = e.attribute("name"); else if (voice == -1) { // no voice applies channel to all voices for // compatibility for (int i = 0; i < VOICES; ++i) _channelNames[i] = e.attribute("name"); } } else if (tag == "aeolus") { int group = e.attribute("group", "-1").toInt(); if (group >= 0 && group <= 4) { aeolusStops[group] = e.text().toInt(); } _setAeolusStops = true; } #endif if (!Text::readProperties(r)) r->unknown(); } }
void StaffText::read(XmlReader& e) { for (int voice = 0; voice < VOICES; ++voice) _channelNames[voice].clear(); clearAeolusStops(); while (e.readNextStartElement()) { const QStringRef& tag(e.name()); if (tag == "MidiAction") { int channel = e.intAttribute("channel", 0); QString name = e.attribute("name"); bool found = false; int n = _channelActions.size(); for (int i = 0; i < n; ++i) { ChannelActions* a = &_channelActions[i]; if (a->channel == channel) { a->midiActionNames.append(name); found = true; break; } } if (!found) { ChannelActions a; a.channel = channel; a.midiActionNames.append(name); _channelActions.append(a); } e.readNext(); } else if (tag == "channelSwitch" || tag == "articulationChange") { int voice = e.intAttribute("voice", -1); if (voice >= 0 && voice < VOICES) _channelNames[voice] = e.attribute("name"); else if (voice == -1) { // no voice applies channel to all voices for // compatibility for (int i = 0; i < VOICES; ++i) _channelNames[i] = e.attribute("name"); } e.readNext(); } else if (tag == "aeolus") { int group = e.intAttribute("group", -1); if (group >= 0 && group < 4) aeolusStops[group] = e.readInt(); else e.readNext(); _setAeolusStops = true; } else if (tag == "swing") { QString swingUnit = e.attribute("unit",""); int unit = 0; if (swingUnit == TDuration(TDuration::DurationType::V_EIGHTH).name()) unit = MScore::division / 2; else if (swingUnit == TDuration(TDuration::DurationType::V_16TH).name()) unit = MScore:: division / 4; else if (swingUnit == TDuration(TDuration::DurationType::V_ZERO).name()) unit = 0; int ratio = e.intAttribute("ratio", 60); setSwing(true); setSwingParameters(unit, ratio); e.readNext(); } else if (!Text::readProperties(e)) e.unknown(); } }