Skip to content

Commit

Permalink
Fix #317227, fix #317185: Disable centering score when opening score …
Browse files Browse the repository at this point in the history
…or switching LayoutMode

Centering the score was maybe esthetically a nice idea, but in practice, it turns out to be less ergonomic / efficient. Therefore, it's now disabled.
The way in which centering the score on opening was implemented also caused issue #317185.
  • Loading branch information
cbjeukendrup authored and vpereverzev committed Mar 4, 2021
1 parent 3ede668 commit 3752d07
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
4 changes: 0 additions & 4 deletions mscore/musescore.cpp
Expand Up @@ -2661,10 +2661,6 @@ void MuseScore::setCurrentScoreView(ScoreView* view)
}
cs = cv->score();
cv->setFocusRect();
if (!cv->wasShown) {
cv->wasShown = true;
cv->pageTop();
}
}
else
cs = 0;
Expand Down
42 changes: 2 additions & 40 deletions mscore/scoreview.cpp
Expand Up @@ -236,6 +236,7 @@ void ScoreView::setScore(Score* s)
}
else
_score->addViewer(this);
pageTop(); // (re)set position
}

if (shadowNote == 0) {
Expand Down Expand Up @@ -3582,46 +3583,7 @@ void ScoreView::screenPrev()

void ScoreView::pageTop()
{
switch (score()->layoutMode()) {
case LayoutMode::PAGE:
{
qreal dx = thinPadding, dy = thinPadding;
Page* firstPage = score()->pages().front();
Page* lastPage = score()->pages().back();
if (firstPage && lastPage) {
QPointF offsetPt(xoffset(), yoffset());
QRectF firstPageRect(firstPage->pos().x() * physicalZoomLevel(),
firstPage->pos().y() * physicalZoomLevel(),
firstPage->width() * physicalZoomLevel(),
firstPage->height() * physicalZoomLevel());
QRectF lastPageRect(lastPage->pos().x() * physicalZoomLevel(),
lastPage->pos().y() * physicalZoomLevel(),
lastPage->width() * physicalZoomLevel(),
lastPage->height() * physicalZoomLevel());
QRectF pagesRect = firstPageRect.united(lastPageRect);
dx = qMax(thinPadding, (width() - pagesRect.width()) / 2);
dy = qMax(thinPadding, (height() - pagesRect.height()) / 2);
}
setOffset(dx, dy);
break;
}
case LayoutMode::LINE:
setOffset(thinPadding, 0.0);
break;
case LayoutMode::SYSTEM:
{
qreal dx = thinPadding, dy = thinPadding;
Page* page = score()->pages().front();
if (page) {
dx = qMax(thinPadding, (width() - page->width() * physicalZoomLevel()) / 2);
}
setOffset(dx, dy);
break;
}
default:
setOffset(thinPadding, thinPadding);
break;
}
setOffset(thinPadding, score()->layoutMode() == LayoutMode::LINE ? 0.0 : thinPadding);
update();
}

Expand Down
1 change: 0 additions & 1 deletion mscore/scoreview.h
Expand Up @@ -428,7 +428,6 @@ class ScoreView : public QWidget, public MuseScoreView {
void setEditElement(Element*);
void updateEditElement();

bool wasShown = false;
bool noteEntryMode() const { return state == ViewState::NOTE_ENTRY; }
bool editMode() const { return state == ViewState::EDIT; }
bool textEditMode() const { return editMode() && editData.element && editData.element->isTextBase(); }
Expand Down

0 comments on commit 3752d07

Please sign in to comment.