Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/engraving/dom/lyrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ void Score::forAllLyrics(std::function<void(Lyrics*)> f)
void Lyrics::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::VERSE && verse() != v.toInt()) {
PartialLyricsLine* prevPartial = findPrevPartialLyricsLineDash(this);

for (Lyrics* l : chordRest()->lyrics()) {
if (l->verse() == v.toInt()) {
// verse already exists, swap
Expand All @@ -568,6 +570,10 @@ void Lyrics::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps
}
}
TextBase::undoChangeProperty(id, v, ps);
if (prevPartial && prevPartial->verse() != v.toInt()) {
// Skip logic to update Lyrics by calling parent class
prevPartial->LyricsLine::undoChangeProperty(id, v, ps);
}
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/lyrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class Lyrics final : public TextBase
PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const PropertyValue&) override;
PropertyValue propertyDefault(Pid id) const override;
void undoChangeProperty(Pid id, const PropertyValue&, PropertyFlags ps) override;
void triggerLayout() const override;

double yRelativeToStaff() const;
Expand All @@ -110,8 +111,6 @@ class Lyrics final : public TextBase
Lyrics(ChordRest* parent);
Lyrics(const Lyrics&);

void undoChangeProperty(Pid id, const PropertyValue&, PropertyFlags ps) override;

int m_verse = 0; // row index
Fraction m_ticks; // if > 0 then draw an underline to tick() + _ticks (melisma)
LyricsSyllabic m_syllabic = LyricsSyllabic::SINGLE;
Expand Down Expand Up @@ -229,6 +228,7 @@ class PartialLyricsLine final : public LyricsLine
bool setProperty(Pid propertyId, const PropertyValue&) override;
PropertyValue propertyDefault(Pid propertyId) const override;
Sid getPropertyStyle(Pid propertyId) const override;
void undoChangeProperty(Pid id, const PropertyValue&, PropertyFlags ps) override;

Lyrics* findLyricsInPreviousRepeatSeg() const;
Lyrics* findAdjacentLyricsOrDefault() const;
Expand Down
25 changes: 25 additions & 0 deletions src/engraving/dom/lyricsline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,31 @@ Sid PartialLyricsLine::getPropertyStyle(Pid propertyId) const
}
}

void PartialLyricsLine::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::VERSE && verse() != v.toInt()) {
ChordRest* endCR = endElement()
&& endElement()->isChordRest() ? toChordRest(endElement()) : nullptr;
Lyrics* endLyrics = nullptr;
if (endCR) {
for (Lyrics* lyr : endCR->lyrics()) {
if (lyr->verse() == verse()) {
endLyrics = lyr;
break;
}
}
}

LyricsLine::undoChangeProperty(id, v, ps);
if (endLyrics && endLyrics->verse() != v.toInt()) {
endLyrics->undoChangeProperty(id, v, ps);
}
return;
}

LyricsLine::undoChangeProperty(id, v, ps);
}

void PartialLyricsLine::doComputeEndElement()
{
LyricsLine::doComputeEndElement();
Expand Down
30 changes: 19 additions & 11 deletions src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,28 +1555,37 @@ void Score::removeElement(EngravingItem* element)
) {
MeasureBase* mb = toMeasureBase(element);
measures()->remove(mb);
System* system = mb->system();

System* system = mb->system();
if (!system) {
// vertical boxes are not shown in continuous view so no system
#ifndef NDEBUG
bool noSystemMode = lineMode() && element->isVBoxBase();
#endif
// vertical boxes are not shown in continuous view so no system
const bool noSystemMode = lineMode() && element->isVBoxBase();
assert(noSystemMode || !isOpen());
#endif
return;
}

Page* page = system->page();
if (element->isBox() && system->measures().size() == 1) {
auto i = std::find(page->systems().begin(), page->systems().end(), system);
page->systems().erase(i);
mb->resetExplicitParent();
if (page->systems().empty()) {
system->removeMeasure(mb);

// See also InsertRemoveMeasures::removeMeasures()
if (element->isBox() && system->measures().empty()) {
Page* page = system->page();
if (page) {
muse::remove(page->systems(), system);
}

muse::remove(m_systems, system);
deleteLater(system);

if (page && page->systems().empty()) {
// Remove this page, since it is now empty.
// This involves renumbering and repositioning all subsequent pages.
PointF pos = page->pos();
auto ii = std::find(pages().begin(), pages().end(), page);
pages().erase(ii);
deleteLater(page);

while (ii != pages().end()) {
page = *ii;
page->setPageNumber(page->pageNumber() - 1);
Expand All @@ -1587,7 +1596,6 @@ void Score::removeElement(EngravingItem* element)
}
}
}
// setLayout(mb->tick());
return;
}

Expand Down
14 changes: 10 additions & 4 deletions src/engraving/editing/editmeasures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,16 @@ void InsertRemoveMeasures::removeMeasures()
if (page) {
// erase system from page
muse::remove(page->systems(), s);
// erase system from score
muse::remove(score->systems(), s);
// finally delete system
score->deleteLater(s);
}
// erase system from score
muse::remove(score->systems(), s);
// finally delete system
score->deleteLater(s);

if (page && page->systems().empty()) {
// if page is empty, delete it as well
muse::remove(score->pages(), page);
score->deleteLater(page);
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions src/engraving/rendering/score/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ void ChordLayout::layoutPitched(Chord* item, LayoutContext& ctx)
}
}

for (EngravingItem* e : item->el()) {
if (e->isChordBracket()) {
TLayout::layoutItem(e, ctx);
}
}

// A chord can have its own arpeggio and also be part of another arpeggio's span. We need to lay out both of these arpeggios properly
Arpeggio* oldSpanArp = item->spanArpeggio();
Arpeggio* newSpanArp = nullptr;
Expand Down Expand Up @@ -296,7 +290,9 @@ void ChordLayout::layoutPitched(Chord* item, LayoutContext& ctx)
}

for (EngravingItem* e : item->el()) {
if (e->isSlur()) { // we cannot at this time as chordpositions are not fixed
// Cannot layout slurs as chord positions are not fixed
// Chord brackets should be the outermost element
if (e->isSlur() || e->isChordBracket()) {
continue;
}
TLayout::layoutItem(e, ctx);
Expand Down Expand Up @@ -341,6 +337,12 @@ void ChordLayout::layoutPitched(Chord* item, LayoutContext& ctx)
createParenGroups(item);
ParenthesisLayout::layoutChordParentheses(item, ctx);

for (EngravingItem* e : item->el()) {
if (e->isChordBracket()) {
TLayout::layoutItem(e, ctx);
}
}

fillShape(item, item->mutldata(), ctx.conf());
}

Expand Down
4 changes: 3 additions & 1 deletion src/engraving/rendering/score/parenthesislayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ Shape ParenthesisLayout::getParentShape(const EngravingItem* parent)
return !s.item() || s.item()->isParenthesis()
|| (s.item()->isLaissezVibSegment() && isChord)
|| (s.item()->isHook() && isChord)
|| (s.item()->isStem() && isChord);
|| (s.item()->isStem() && isChord)
|| (s.item()->isArpeggio() && isChord)
|| (s.item()->isChordBracket() && isChord);
});

return parentShape;
Expand Down
3 changes: 3 additions & 0 deletions src/engraving/rendering/score/slurtielayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,9 @@ void SlurTieLayout::computeBezier(TieSegment* tieSeg, PointF shoulderOffset)
{
const PointF tieStart = tieSeg->ups(Grip::START).p + tieSeg->ups(Grip::START).off;
const PointF tieEnd = tieSeg->ups(Grip::END).p + tieSeg->ups(Grip::END).off;
if (!muse::RealIsEqualOrMore(tieEnd.x(), tieStart.x())) {
return;
}

PointF tieEndNormalized = tieEnd - tieStart; // normalize to zero
if (muse::RealIsNull(tieEndNormalized.x())) {
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rw/read460/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ void TRead::read(Dynamic* d, XmlReader& e, ReadContext& ctx)
} else if (tag == "play") {
d->setPlayDynamic(e.readBool());
} else if (ctx.mscVersion() < 470 && tag == "dynamicsSize") {
d->setSymbolScale(e.readDouble());
readProperty(d, e, ctx, Pid::MUSICAL_SYMBOLS_SCALE);
} else if (readProperty(d, tag, e, ctx, Pid::AVOID_BARLINES)) {
} else if (readProperty(d, tag, e, ctx, Pid::CENTER_ON_NOTEHEAD)) {
} else if (readProperty(d, tag, e, ctx, Pid::ANCHOR_TO_END_OF_PREVIOUS)) {
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rw/write/twrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ void TWrite::write(const Chord* item, XmlWriter& xml, WriteContext& ctx)
if (item->hook() && item->hook()->isUserModified()) {
write(item->hook(), xml, ctx);
}
if (item->showStemSlash() && item->isUserModified()) {
if (item->showStemSlash() != item->propertyDefault(Pid::SHOW_STEM_SLASH).toBool()) {
xml.tag("showStemSlash", item->showStemSlash());
}
if (item->stemSlash() && item->stemSlash()->isUserModified()) {
Expand Down
1 change: 1 addition & 0 deletions src/engraving/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ set(MODULE_TEST_SRC
${CMAKE_CURRENT_LIST_DIR}/fretdiagram_tests.cpp
${CMAKE_CURRENT_LIST_DIR}/engraving_xml_tests.cpp
${CMAKE_CURRENT_LIST_DIR}/parentheses_tests.cpp
${CMAKE_CURRENT_LIST_DIR}/lyrics_tests.cpp
${CMAKE_CURRENT_LIST_DIR}/automation/automation_tests.cpp

${CMAKE_CURRENT_LIST_DIR}/mocks/engravingconfigurationmock.h
Expand Down
Loading
Loading