diff --git a/src/engraving/dom/dynamic.cpp b/src/engraving/dom/dynamic.cpp index 5eb24d4433abb..cf591ad4994f0 100644 --- a/src/engraving/dom/dynamic.cpp +++ b/src/engraving/dom/dynamic.cpp @@ -266,7 +266,7 @@ double Dynamic::customTextOffset() const } for (const TextBlock& block : ldata->blocks) { for (const std::shared_ptr& fragment : block.fragments()) { - if (fragment->text == referenceFragment->text) { + if (fragment->text() == referenceFragment->text()) { return fragment->pos.x() - referenceFragment->pos.x(); } } diff --git a/src/engraving/dom/page.cpp b/src/engraving/dom/page.cpp index 7d10ae6a74467..3843baf6a8ec2 100644 --- a/src/engraving/dom/page.cpp +++ b/src/engraving/dom/page.cpp @@ -380,10 +380,10 @@ void Page::doRebuildBspTree() TextBlock Page::replaceTextMacros(const TextBlock& tb) const { - std::list> newFragments = { std::make_shared() }; + std::list > newFragments = { std::make_shared() }; for (const std::shared_ptr& tf: tb.fragments()) { const CharFormat defaultFormat = tf->format; - const String& s = tf->text; + const String& s = tf->text(); for (size_t i = 0, n = s.size(); i < n; ++i) { newFragments.back()->format = defaultFormat; @@ -409,7 +409,7 @@ TextBlock Page::replaceTextMacros(const TextBlock& tb) const const CharFormat pageNumberFormat = formatForMacro(String('$' + nc)); // If the default format equals the format for this macro, we don't need to create a new fragment... if (defaultFormat == pageNumberFormat) { - newFragments.back()->text += pageNumberString; + newFragments.back()->appendText(pageNumberString); break; } std::shared_ptr pageNumberFragment = std::make_shared(pageNumberString); @@ -420,7 +420,7 @@ TextBlock Page::replaceTextMacros(const TextBlock& tb) const } break; case 'n': - newFragments.back()->text += String::number(score()->npages() + score()->pageNumberOffset()); + newFragments.back()->appendText(String::number(score()->npages() + score()->pageNumberOffset())); break; case 'i': // not on first page if (!m_no) { @@ -428,43 +428,43 @@ TextBlock Page::replaceTextMacros(const TextBlock& tb) const } // FALLTHROUGH case 'I': - newFragments.back()->text += score()->metaTag(u"partName"); + newFragments.back()->appendText(score()->metaTag(u"partName")); break; case 'f': - newFragments.back()->text += masterScore()->fileInfo()->fileName(false).toString(); + newFragments.back()->appendText(masterScore()->fileInfo()->fileName(false).toString()); break; case 'F': - newFragments.back()->text += masterScore()->fileInfo()->path().toString(); + newFragments.back()->appendText(masterScore()->fileInfo()->path().toString()); break; case 'd': - newFragments.back()->text += muse::Date::currentDate().toString(muse::DateFormat::ISODate); + newFragments.back()->appendText(muse::Date::currentDate().toString(muse::DateFormat::ISODate)); break; case 'D': { String creationDate = score()->metaTag(u"creationDate"); if (creationDate.isEmpty()) { - newFragments.back()->text += masterScore()->fileInfo()->birthTime().date().toString( - muse::DateFormat::ISODate); + newFragments.back()->appendText(masterScore()->fileInfo()->birthTime().date().toString( + muse::DateFormat::ISODate)); } else { - newFragments.back()->text += muse::Date::fromStringISOFormat(creationDate).toString( - muse::DateFormat::ISODate); + newFragments.back()->appendText(muse::Date::fromStringISOFormat(creationDate).toString( + muse::DateFormat::ISODate)); } } break; case 'm': if (score()->dirty() || !masterScore()->saved()) { - newFragments.back()->text += muse::Time::currentTime().toString(muse::DateFormat::ISODate); + newFragments.back()->appendText(muse::Time::currentTime().toString(muse::DateFormat::ISODate)); } else { - newFragments.back()->text += masterScore()->fileInfo()->lastModified().time().toString( - muse::DateFormat::ISODate); + newFragments.back()->appendText(masterScore()->fileInfo()->lastModified().time().toString( + muse::DateFormat::ISODate)); } break; case 'M': if (score()->dirty() || !masterScore()->saved()) { - newFragments.back()->text += muse::Date::currentDate().toString(muse::DateFormat::ISODate); + newFragments.back()->appendText(muse::Date::currentDate().toString(muse::DateFormat::ISODate)); } else { - newFragments.back()->text += masterScore()->fileInfo()->lastModified().date().toString( - muse::DateFormat::ISODate); + newFragments.back()->appendText(masterScore()->fileInfo()->lastModified().date().toString( + muse::DateFormat::ISODate)); } break; case 'C': // only on first page @@ -478,7 +478,7 @@ TextBlock Page::replaceTextMacros(const TextBlock& tb) const const CharFormat copyrightFormat = formatForMacro(String('$' + nc)); // If the default format equals the format for this macro, we don't need to create a new fragment... if (defaultFormat == copyrightFormat) { - newFragments.back()->text += copyrightString; + newFragments.back()->appendText(copyrightString); break; } std::shared_ptr copyrightFragment = std::make_shared(copyrightString); @@ -489,25 +489,25 @@ TextBlock Page::replaceTextMacros(const TextBlock& tb) const break; case 'v': if (score()->dirty()) { - newFragments.back()->text += score()->appVersion(); + newFragments.back()->appendText(score()->appVersion()); } else { - newFragments.back()->text += score()->mscoreVersion(); + newFragments.back()->appendText(score()->mscoreVersion()); } break; case 'r': if (score()->dirty()) { - newFragments.back()->text += revision; + newFragments.back()->appendText(revision); } else { int rev = score()->mscoreRevision(); if (rev > 99999) { // MuseScore 1.3 is decimal 5702, 2.0 and later uses a 7-digit hex SHA - newFragments.back()->text += String::number(rev, 16); + newFragments.back()->appendText(String::number(rev, 16)); } else { - newFragments.back()->text += String::number(rev, 10); + newFragments.back()->appendText(String::number(rev, 10)); } } break; case '$': - newFragments.back()->text += '$'; + newFragments.back()->appendText(String('$')); break; case ':': { @@ -520,19 +520,19 @@ TextBlock Page::replaceTextMacros(const TextBlock& tb) const tag += s.at(k); } if (k != n) { // found ':' ? - newFragments.back()->text += score()->metaTag(tag); + newFragments.back()->appendText(score()->metaTag(tag)); i = k - 1; } } break; default: - newFragments.back()->text += '$'; - newFragments.back()->text += nc; + newFragments.back()->appendText(String('$')); + newFragments.back()->appendText(nc); break; } ++i; } else { - newFragments.back()->text += c; + newFragments.back()->appendText(c); } } } diff --git a/src/engraving/dom/textbase.cpp b/src/engraving/dom/textbase.cpp index d0d20647685e5..676e5427cd9a6 100644 --- a/src/engraving/dom/textbase.cpp +++ b/src/engraving/dom/textbase.cpp @@ -744,7 +744,7 @@ int TextCursor::position(int row, int column) const //--------------------------------------------------------- TextFragment::TextFragment(const String& s) { - text = s; + m_text = s; } TextFragment::TextFragment(TextCursor* cursor, const String& s) @@ -755,14 +755,14 @@ TextFragment::TextFragment(TextCursor* cursor, const String& s) TextFragment::TextFragment(const TextFragment& f) { - text = f.text; + m_text = f.m_text; format = f.format; pos = f.pos; } TextFragment& TextFragment::operator =(const TextFragment& f) { - text = f.text; + m_text = f.m_text; format = f.format; pos = f.pos; return *this; @@ -779,13 +779,13 @@ std::shared_ptr TextFragment::split(int column) std::shared_ptr f = std::make_shared(); f->format = format; - for (size_t i = 0; i < text.size(); ++i) { - const Char& c = text.at(i); + for (size_t i = 0; i < m_text.size(); ++i) { + const Char& c = m_text.at(i); if (col == column) { if (idx) { - if (idx < text.size()) { - f->text = text.mid(idx); - text = text.left(idx); + if (idx < m_text.size()) { + f->setText(m_text.mid(idx)); + m_text = m_text.left(idx); } } return f; @@ -806,8 +806,8 @@ std::shared_ptr TextFragment::split(int column) int TextFragment::columns() const { int col = 0; - for (size_t i = 0; i < text.size(); ++i) { - if (text.at(i).isHighSurrogate()) { + for (size_t i = 0; i < m_text.size(); ++i) { + if (m_text.at(i).isHighSurrogate()) { continue; } ++col; @@ -821,7 +821,7 @@ int TextFragment::columns() const bool TextFragment::operator ==(const TextFragment& f) const { - return format == f.format && text == f.text; + return format == f.format && m_text == f.m_text; } //--------------------------------------------------------- @@ -833,10 +833,10 @@ void TextFragment::draw(Painter* p, const TextBase* t) const Font f(font(t)); f.setPointSizeF(f.pointSizeF() * MScore::pixelRatio); #ifndef Q_OS_MACOS - TextBase::drawTextWorkaround(p, f, pos, text); + TextBase::drawTextWorkaround(p, f, pos, m_text); #else p->setFont(f); - p->drawText(pos, text); + p->drawText(pos, m_text); #endif } @@ -930,13 +930,13 @@ Font TextFragment::font(const TextBase* t) const FontMetrics fm(font); bool fail = false; - for (size_t i = 0; i < text.size(); ++i) { - const Char& c = text.at(i); + for (size_t i = 0; i < m_text.size(); ++i) { + const Char& c = m_text.at(i); if (c.isHighSurrogate()) { - if (i + 1 == text.size()) { + if (i + 1 == m_text.size()) { ASSERT_X("bad string"); } - const Char& c2 = text.at(i + 1); + const Char& c2 = m_text.at(i + 1); ++i; char32_t v = Char::surrogateToUcs4(c, c2); if (!fm.inFontUcs4(v)) { @@ -1032,7 +1032,7 @@ void TextBlock::layout(const TextBase* t) FontMetrics fm = t->fontMetrics(); m_shape.add(RectF(0.0, -fm.ascent(), 1.0, fm.descent()), t); m_lineSpacing = fm.lineSpacing(); - } else if (m_fragments.size() == 1 && m_fragments.front()->text.isEmpty()) { + } else if (m_fragments.size() == 1 && m_fragments.front()->text().isEmpty()) { std::shared_ptr& f = m_fragments.front(); f->pos.setX(x); FontMetrics fm(f->font(t)); @@ -1074,11 +1074,11 @@ void TextBlock::layout(const TextBase* t) // Optimization: don't calculate character position // for the next fragment if there is no next fragment if (fi != fiLast) { - const double w = fm.width(f->text); + const double w = fm.width(f->text()); x += w; } - RectF textBRect = fm.tightBoundingRect(f->text).translated(f->pos); + RectF textBRect = fm.tightBoundingRect(f->text()).translated(f->pos); bool useDynamicSymShape = fragmentFont.type() == Font::Type::MusicSymbol && t->isDynamic(); if (useDynamicSymShape) { const Dynamic* dyn = toDynamic(t); @@ -1136,7 +1136,7 @@ std::list> TextBlock::fragmentsWithoutEmpty() { std::list> list; for (const auto& x : m_fragments) { - if (!x->text.isEmpty()) { + if (!x->text().isEmpty()) { list.push_back(x); } } @@ -1157,14 +1157,14 @@ double TextBlock::xpos(size_t column, const TextBase* t) const } FontMetrics fm(f->font(t)); size_t idx = 0; - for (size_t i = 0; i < f->text.size(); ++i) { + for (size_t i = 0; i < f->text().size(); ++i) { ++idx; - if (f->text.at(i).isHighSurrogate()) { + if (f->text().at(i).isHighSurrogate()) { continue; } ++col; if (column == col) { - return f->pos.x() + fm.width(f->text.left(idx)); + return f->pos.x() + fm.width(f->text().left(idx)); } } } @@ -1183,8 +1183,8 @@ const std::shared_ptr TextBlock::fragment(int column) const int col = 0; auto f = m_fragments.begin(); for (; f != m_fragments.end(); ++f) { - for (size_t i = 0; i < (*f)->text.size(); ++i) { - if ((*f)->text.at(i).isHighSurrogate()) { + for (size_t i = 0; i < (*f)->text().size(); ++i) { + if ((*f)->text().at(i).isHighSurrogate()) { continue; } if (column == col) { @@ -1232,8 +1232,8 @@ size_t TextBlock::columns() const { size_t col = 0; for (const std::shared_ptr& f : m_fragments) { - for (size_t i = 0; i < f->text.size(); ++i) { - if (!f->text.at(i).isHighSurrogate()) { + for (size_t i = 0; i < f->text().size(); ++i) { + if (!f->text().at(i).isHighSurrogate()) { ++col; } } @@ -1256,13 +1256,13 @@ int TextBlock::column(double x, TextBase* t) const return col; } double px = 0.0; - for (size_t i = 0; i < f->text.size(); ++i) { + for (size_t i = 0; i < f->text().size(); ++i) { ++idx; - if (f->text.at(i).isHighSurrogate()) { + if (f->text().at(i).isHighSurrogate()) { continue; } FontMetrics fm(f->font(t)); - double xo = fm.width(f->text.left(idx)); + double xo = fm.width(f->text().left(idx)); if (x <= f->pos.x() + px + (xo - px) * .5) { return col; } @@ -1292,11 +1292,11 @@ void TextBlock::insert(TextCursor* cursor, const String& s) m_fragments.insert(std::next(i), f2); } } else { - (*i)->text.insert(ridx, s); + (*i)->setText((*i)->text().insert(ridx, s)); } } else { if (!m_fragments.empty() && m_fragments.back()->format == *cursor->format()) { - m_fragments.back()->text.append(s); + m_fragments.back()->appendText(s); } else { m_fragments.push_back(std::make_shared(TextFragment(cursor, s))); } @@ -1313,7 +1313,7 @@ void TextBlock::insert(TextCursor* cursor, const String& s) void TextBlock::insertEmptyFragmentIfNeeded(TextCursor* cursor) { - if (m_fragments.size() == 0 || m_fragments.front()->text.isEmpty()) { + if (m_fragments.size() == 0 || m_fragments.front()->text().isEmpty()) { m_fragments.insert(m_fragments.begin(), std::make_shared(TextFragment(cursor, u""))); } } @@ -1324,7 +1324,7 @@ void TextBlock::insertEmptyFragmentIfNeeded(TextCursor* cursor) void TextBlock::removeEmptyFragment() { - if (m_fragments.size() > 0 && m_fragments.front()->text.isEmpty()) { + if (m_fragments.size() > 0 && m_fragments.front()->text().isEmpty()) { m_fragments.pop_back(); } } @@ -1345,12 +1345,12 @@ std::list>::iterator TextBlock::fragment(int colum for (auto it = m_fragments.begin(); it != m_fragments.end(); ++it) { *rcol = 0; *ridx = 0; - for (size_t i = 0; i < (*it)->text.size(); ++i) { + for (size_t i = 0; i < (*it)->text().size(); ++i) { if (col == column) { return it; } ++*ridx; - if ((*it)->text.at(i).isHighSurrogate()) { + if ((*it)->text().at(i).isHighSurrogate()) { continue; } ++col; @@ -1372,16 +1372,16 @@ String TextBlock::remove(int column, TextCursor* cursor) size_t idx = 0; auto fragment = *it; - for (size_t i = 0; i < fragment->text.size(); ++i) { + for (size_t i = 0; i < fragment->text().size(); ++i) { if (col == column) { - if (fragment->text.at(i).isSurrogate()) { - s = fragment->text.mid(idx, 2); - fragment->text.remove(idx, 2); + if (fragment->text().at(i).isSurrogate()) { + s = fragment->text().mid(idx, 2); + fragment->setText(fragment->text().remove(idx, 2)); } else { - s = fragment->text.mid(idx, 1); - fragment->text.remove(idx, 1); + s = fragment->text().mid(idx, 1); + fragment->setText(fragment->text().remove(idx, 1)); } - if (fragment->text.isEmpty()) { + if (fragment->text().isEmpty()) { m_fragments.erase(it); } simplify(); @@ -1389,7 +1389,7 @@ String TextBlock::remove(int column, TextCursor* cursor) return s; } ++idx; - if (fragment->text.at(i).isHighSurrogate()) { + if (fragment->text().at(i).isHighSurrogate()) { continue; } ++col; @@ -1414,7 +1414,7 @@ void TextBlock::simplify() ++i; for (; i != m_fragments.end(); ++i) { while (i != m_fragments.end() && ((*i)->format == f->format)) { - f->text.append((*i)->text); + f->appendText((*i)->text()); i = m_fragments.erase(i); } if (i == m_fragments.end()) { @@ -1438,17 +1438,17 @@ String TextBlock::remove(int start, int n, TextCursor* cursor) for (auto i = m_fragments.begin(); i != m_fragments.end();) { bool inc = true; std::shared_ptr fragment = *i; - for (size_t idx = 0; idx < fragment->text.size();) { - Char c = fragment->text.at(idx); + for (size_t idx = 0; idx < fragment->text().size();) { + Char c = fragment->text().at(idx); if (col == start) { if (c.isHighSurrogate()) { s += c; - fragment->text.remove(idx, 1); - c = fragment->text.at(idx); + fragment->setText(fragment->text().remove(idx, 1)); + c = fragment->text().at(idx); } s += c; - fragment->text.remove(idx, 1); - if (fragment->text.isEmpty() && (m_fragments.size() > 1)) { + fragment->setText(fragment->text().remove(idx, 1)); + if (fragment->text().isEmpty() && (m_fragments.size() > 1)) { i = m_fragments.erase(i); inc = false; } @@ -1591,14 +1591,14 @@ TextBlock TextBlock::split(int column, TextCursor* cursor) for (auto it = m_fragments.begin(); it != m_fragments.end(); ++it) { size_t idx = 0; std::shared_ptr fragment = *it; - for (size_t i = 0; i < fragment->text.size(); ++i) { + for (size_t i = 0; i < fragment->text().size(); ++i) { if (col == column) { if (idx) { - if (idx < fragment->text.size()) { - std::shared_ptr tf = std::make_shared(fragment->text.mid(idx)); + if (idx < fragment->text().size()) { + std::shared_ptr tf = std::make_shared(fragment->text().mid(idx)); tf->format = fragment->format; tl.m_fragments.push_back(tf); - fragment->text = fragment->text.left(idx); + fragment->setText(fragment->text().left(idx)); ++it; } } @@ -1612,7 +1612,7 @@ TextBlock TextBlock::split(int column, TextCursor* cursor) return tl; } ++idx; - if (fragment->text.at(i).isHighSurrogate()) { + if (fragment->text().at(i).isHighSurrogate()) { continue; } ++col; @@ -1650,15 +1650,15 @@ String TextBlock::text(int col1, int len, bool withFormat) const double size; String family; for (const auto& f : m_fragments) { - if (f->text.isEmpty()) { + if (f->text().isEmpty()) { continue; } if (withFormat) { s += TextBase::getHtmlStartTag(f->format.fontSize(), size, f->format.fontFamily(), family, f->format.style(), f->format.valign()); } - for (size_t i = 0; i < f->text.size(); ++i) { - Char c = f->text.at(i); + for (size_t i = 0; i < f->text().size(); ++i) { + Char c = f->text().at(i); if (col >= col1 && (len < 0 || ((col - col1) < len))) { if (f->format.fontFamily() == "ScoreText" && withFormat) { s += toSymbolXml(c); @@ -2262,11 +2262,11 @@ String TextBase::genText(const LayoutData* ldata) const } } if (format.fontFamily() == u"ScoreText") { - for (size_t i = 0; i < f->text.size(); ++i) { - text += toSymbolXml(f->text.at(i)); + for (size_t i = 0; i < f->text().size(); ++i) { + text += toSymbolXml(f->text().at(i)); } } else { - text += XmlWriter::xmlString(f->text); + text += XmlWriter::xmlString(f->text()); } fmt = format; } @@ -2357,10 +2357,10 @@ void TextBase::computeHighResShape(const FontMetrics& fontMetrics) double x = 0; for (const std::shared_ptr& fragment : block.fragments()) { x += fragment->pos.x(); - size_t textSize = fragment->text.size(); + size_t textSize = fragment->text().size(); for (size_t i = 0; i < textSize; ++i) { - Char character = fragment->text.at(i); - RectF characterBoundingRect = fontMetrics.tightBoundingRect(fragment->text.at(i)); + Char character = fragment->text().at(i); + RectF characterBoundingRect = fontMetrics.tightBoundingRect(fragment->text().at(i)); characterBoundingRect.translate(x, 0.0); highResShape.add(characterBoundingRect); if (i + 1 < textSize) { @@ -2496,7 +2496,7 @@ std::list> TextBase::fragmentList() const res.push_back(f->clone()); if (block.eol()) { // simply append a newline - res.back()->text += u"\n"; + res.back()->appendText(u"\n"); } } } @@ -2526,7 +2526,7 @@ String TextBase::plainText() const const LayoutData* tmlldata = text->ldata(); for (const TextBlock& block : tmlldata->blocks) { for (const std::shared_ptr& f : block.fragments()) { - s += f->text; + s += f->text(); } if (block.eol()) { s += Char::LineFeed; @@ -3352,7 +3352,7 @@ bool TextBase::hasCustomFormatting() const for (const TextBlock& block : ldata->blocks) { for (const std::shared_ptr& f : block.fragments()) { - if (f->text.isEmpty()) { // skip empty fragments, not to + if (f->text().isEmpty()) { // skip empty fragments, not to continue; // insert extra HTML formatting } const CharFormat& format = f->format; @@ -3435,7 +3435,7 @@ String TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace) c for (const TextBlock& block : ldata->blocks) { for (const std::shared_ptr& f : block.fragments()) { - if (f->text.isEmpty()) { // skip empty fragments, not to + if (f->text().isEmpty()) { // skip empty fragments, not to continue; // insert extra HTML formatting } const CharFormat& format = f->format; @@ -3494,7 +3494,7 @@ String TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace) c break; } } - _txt += XmlWriter::xmlString(f->text); + _txt += XmlWriter::xmlString(f->text()); fmt = format; } if (block.eol()) { diff --git a/src/engraving/dom/textbase.h b/src/engraving/dom/textbase.h index 58223bd62eca3..b2bcc80b2c893 100644 --- a/src/engraving/dom/textbase.h +++ b/src/engraving/dom/textbase.h @@ -219,7 +219,6 @@ class TextFragment public: mutable CharFormat format; PointF pos; // y is relative to TextBlock->y() - mutable String text; TextFragment() = default; TextFragment(const String& s); @@ -227,16 +226,22 @@ class TextFragment TextFragment(const TextFragment& f); TextFragment& operator =(const TextFragment& f); - bool operator ==(const TextFragment& f) const; virtual std::shared_ptr clone() { return std::make_shared(*this); } + String text() const { return m_text; } + virtual void setText(String text) { m_text = text; } + virtual void appendText(String text) { m_text += text; } + std::shared_ptr split(int column); void draw(muse::draw::Painter*, const TextBase*) const; muse::draw::Font font(const TextBase*) const; int columns() const; void changeFormat(FormatId id, const FormatValue& data); + +private: + String m_text; }; //--------------------------------------------------------- diff --git a/src/importexport/musicxml/internal/musicxml/shared/musicxmlfonthandler.cpp b/src/importexport/musicxml/internal/musicxml/shared/musicxmlfonthandler.cpp index 3cdb914ca9e51..d553739829113 100644 --- a/src/importexport/musicxml/internal/musicxml/shared/musicxmlfonthandler.cpp +++ b/src/importexport/musicxml/internal/musicxml/shared/musicxmlfonthandler.cpp @@ -78,11 +78,11 @@ String MScoreTextToMusicXml::toPlainText(const String& text) // convert to plain text plus [name] encoded symbols //--------------------------------------------------------- -String MScoreTextToMusicXml::toPlainTextPlusSymbols(const std::list>& list) +String MScoreTextToMusicXml::toPlainTextPlusSymbols(const std::list >& list) { String res; for (const std::shared_ptr& f : list) { - res += f->text; + res += f->text(); } return res; } @@ -100,7 +100,7 @@ static int plainTextPlusSymbolsFragmentSize(const std::shared_ptr& // plainTextPlusSymbolsSize //--------------------------------------------------------- -static int plainTextPlusSymbolsListSize(const std::list>& list) +static int plainTextPlusSymbolsListSize(const std::list >& list) { int res = 0; for (const std::shared_ptr& f : list) { @@ -120,8 +120,9 @@ static int plainTextPlusSymbolsListSize(const std::list>& in, const int pos, const int len, - std::list>& left, std::list>& mid, std::list>& right) +bool MScoreTextToMusicXml::split(const std::list >& in, const int pos, const int len, + std::list >& left, std::list >& mid, + std::list >& right) { //LOGD("MScoreTextToMXML::split in size %d pos %d len %d", plainTextPlusSymbolsListSize(in), pos, len); //LOGD("-> in"); @@ -137,12 +138,12 @@ bool MScoreTextToMusicXml::split(const std::list>& right.clear(); // set pos to begin of first fragment - std::list>::const_iterator fragmentNr = in.begin(); + std::list >::const_iterator fragmentNr = in.begin(); std::shared_ptr fragment; if (fragmentNr != in.end()) { fragment = *fragmentNr; } - std::list>* currentDest = &left; + std::list >* currentDest = &left; int currentMaxSize = pos; // while text left @@ -195,14 +196,14 @@ bool MScoreTextToMusicXml::split(const std::list>& // writeTextFragments //--------------------------------------------------------- -void MScoreTextToMusicXml::writeTextFragments(const std::list>& fr, XmlWriter& xml) +void MScoreTextToMusicXml::writeTextFragments(const std::list >& fr, XmlWriter& xml) { //dumpText(fr); bool firstTime = true; // write additional attributes only the first time characters are written for (const std::shared_ptr& f : fr) { newFormat = f->format; String formatAttr = updateFormat(); - xml.tagRaw(tagname + (firstTime ? attribs : String()) + formatAttr, f->text); + xml.tagRaw(tagname + (firstTime ? attribs : String()) + formatAttr, f->text()); firstTime = false; } } diff --git a/src/notation/view/widgets/timeline.cpp b/src/notation/view/widgets/timeline.cpp index 1070a170b22de..882639fc3887c 100644 --- a/src/notation/view/widgets/timeline.cpp +++ b/src/notation/view/widgets/timeline.cpp @@ -1448,9 +1448,9 @@ void Timeline::jumpMarkerMeta(Segment* seg, int* stagger, int pos) elementType = ElementType::JUMP; } else { Marker* marker = toMarker(std::get<3>(_repeatInfo)); - std::list> tf_list = marker->fragmentList(); + std::list > tf_list = marker->fragmentList(); for (std::shared_ptr tf : tf_list) { - text.push_back(tf->text); + text.push_back(tf->text()); } measure = marker->measure(); if (marker->markerType() == MarkerType::FINE