Skip to content

Commit

Permalink
Make the method simpler
Browse files Browse the repository at this point in the history
Actually it did nothing more than this. Next question: is that actually desired?
  • Loading branch information
cbjeukendrup committed Jul 26, 2023
1 parent a8f7729 commit 3f8cf2e
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/notation/internal/excerptnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,31 +96,17 @@ void ExcerptNotation::fillWithDefaultInfo()
topVerticalFrame->undoUnlink();
}

auto setText = [&score](TextStyleType textType, const String& xmlText) {
TextBase* textItem = score->getText(textType);

if (!textItem && !xmlText.isEmpty()) {
textItem = score->addText(textType, nullptr /*destinationElement*/, false /*addToAllScores*/);
}

auto unlinkText = [&score](TextStyleType textType) {
engraving::Text* textItem = score->getText(textType);
if (textItem) {
textItem->undoUnlink();
textItem->setXmlText(xmlText);
}
};

auto getText = [&score](TextStyleType textType) {
if (mu::engraving::Text* t = score->getText(textType)) {
return t->xmlText();
}

return String();
};

setText(TextStyleType::TITLE, getText(TextStyleType::TITLE));
setText(TextStyleType::SUBTITLE, getText(TextStyleType::SUBTITLE));
setText(TextStyleType::COMPOSER, getText(TextStyleType::COMPOSER));
setText(TextStyleType::POET, getText(TextStyleType::POET));
unlinkText(TextStyleType::TITLE);
unlinkText(TextStyleType::SUBTITLE);
unlinkText(TextStyleType::COMPOSER);
unlinkText(TextStyleType::POET);
}

mu::engraving::Excerpt* ExcerptNotation::excerpt() const
Expand Down

0 comments on commit 3f8cf2e

Please sign in to comment.