Skip to content

Commit

Permalink
fix #58796: layout of one line staff
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed May 20, 2015
1 parent f1b0364 commit 9f62965
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
26 changes: 24 additions & 2 deletions libmscore/system.cpp
Expand Up @@ -42,12 +42,31 @@

namespace Ms {

//---------------------------------------------------------
// y
//---------------------------------------------------------

qreal SysStaff::y() const
{
return _bbox.y() + _yOff;
}

//---------------------------------------------------------
// setYOff
//---------------------------------------------------------

void SysStaff::setYOff(qreal offset)
{
_yOff = offset;
}

//---------------------------------------------------------
// SysStaff
//---------------------------------------------------------

SysStaff::SysStaff()
{
_yOff = 0.0;
idx = 0;
_show = true;
}
Expand Down Expand Up @@ -368,8 +387,11 @@ void System::layout2()
}
qreal sHeight = staff->height();
qreal dup = staffIdx == 0 ? 0.0 : s->distanceUp();
if (staff->lines() == 1)
dup -= _spatium * staff->mag();
if (staff->lines() == 1) {
qreal off = _spatium * staff->mag();
dup -= off;
s->setYOff(off);
}
s->bbox().setRect(_leftMargin, y + dup, width() - _leftMargin, sHeight);
y += dup + sHeight + s->distanceDown();
lastStaffIdx = staffIdx;
Expand Down
4 changes: 3 additions & 1 deletion libmscore/system.h
Expand Up @@ -44,6 +44,7 @@ class BarLine;

class SysStaff {
QRectF _bbox; ///< Bbox of StaffLines.
qreal _yOff; ///< offset of top staff line within bbox
qreal _distanceUp; ///< distance to previous staff
qreal _distanceDown; ///< distance to next staff
bool _show; ///< derived from Staff or false if empty
Expand All @@ -55,9 +56,10 @@ class SysStaff {
const QRectF& bbox() const { return _bbox; }
QRectF& bbox() { return _bbox; }
QRectF& rbb() { return _bbox; }
qreal y() const { return _bbox.y(); }
qreal right() const { return _bbox.right(); }
void setbbox(const QRectF& r) { _bbox = r; }
qreal y() const;
void setYOff(qreal offset);

qreal distanceUp() const { return _distanceUp; }
void setDistanceUp(qreal v) { _distanceUp = v; }
Expand Down

0 comments on commit 9f62965

Please sign in to comment.