Skip to content

Commit

Permalink
fix wandering systems after edit to second or subsequent systems
Browse files Browse the repository at this point in the history
WHen editing the second or later system on a page,
we don't relayout the previous systems on the page.
Thus, the already-spread value is used as a starting point
causing it to spread further and further with each edit,
and also the calculation of the restHeight for spread of systems
is also off.

Fix is to called the new restoreLayout2() for all those initial systems.
  • Loading branch information
MarcSabatella authored and vpereverzev committed Dec 15, 2020
1 parent 0c7ae9d commit 2cbee43
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4618,22 +4618,29 @@ void LayoutContext::collectPage()
{
const qreal slb = score->styleP(Sid::staffLowerBorder);
bool breakPages = score->layoutMode() != LayoutMode::SYSTEM;
//qreal y = prevSystem ? prevSystem->y() + prevSystem->height() : page->tm();
qreal ey = page->height() - page->bm();
qreal y = 0.0;

System* nextSystem = 0;
int systemIdx = -1;

qreal y = page->systems().isEmpty() ? page->tm() : page->system(0)->y() + page->system(0)->height();
// re-calculate positions for systems before current
// (they may have been filled on previous layout)
int pSystems = page->systems().size();
if (pSystems > 0) {
page->system(0)->restoreLayout2();
y = page->system(0)->y() + page->system(0)->height();
}
else {
y = page->tm();
}
for (int i = 1; i < pSystems; ++i) {
System* cs = page->system(i);
System* ps = page->system(i - 1);
qreal distance = ps->minDistance(cs);
y += distance;
cs->setPos(page->lm(), y);
cs->restoreLayout2();
y += cs->height();
}

Expand Down

0 comments on commit 2cbee43

Please sign in to comment.