From 2cbee4335abda7eefef002878d63d6a0a3870d2f Mon Sep 17 00:00:00 2001 From: Marc Sabatella Date: Tue, 15 Dec 2020 08:39:13 -0700 Subject: [PATCH] fix wandering systems after edit to second or subsequent systems 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. --- libmscore/layout.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libmscore/layout.cpp b/libmscore/layout.cpp index 02b6c1aadcbc6..bb19b4d8b17ac 100644 --- a/libmscore/layout.cpp +++ b/libmscore/layout.cpp @@ -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(); }