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 authored and lasconic committed Jun 10, 2015
1 parent 5feb419 commit c1b5d09
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 5 deletions.
24 changes: 22 additions & 2 deletions libmscore/system.cpp
Original file line number Diff line number Diff line change
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,9 @@ void System::layout2()
}
qreal sHeight = staff->height();
qreal dup = staffIdx == 0 ? 0.0 : s->distanceUp();
if (staff->lines() == 1)
dup -= _spatium * staff->mag();
// one-line staves get additional padding for their bbox
qreal off = staff->lines() == 1 ? _spatium * staff->mag() : 0.0;
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
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion vtest/gen
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ else
beams-11 beams-12 beams-13 beams-14 beams-15 beams-16 beams-17\
user-offset-1 user-offset-2 chord-space-1 chord-space-2 tablature-1 image-1\
lyrics-1 lyrics-2 lyrics-3 lyrics-4 lyrics-5 lyrics-6 voice-1 voice-2 slash-1 slash-2\
system-1 system-2 system-3 system-4 small-1"
system-1 system-2 system-3 system-4 system-5 small-1"
fi

DPI=130
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set SRC=mmrest-1,bravura-mmrest,gonville-mmrest,mmrest-2,mmrest-4,mmrest-5,mmres
beams-11,beams-12,beams-13,beams-14,beams-15,beams-16,beams-17, ^
user-offset-1,user-offset-2,chord-space-1,chord-space-2,tablature-1,image-1, ^
lyrics-1,lyrics-2,lyrics-3,lyrics-4,lyrics-5,lyrics-6,voice-1,voice-2,slash-1,slash-2, ^
system-1,system-2,system-3,system-4,small-1
system-1,system-2,system-3,system-4,small-1,system-5

set MSCORE=..\win32install\bin\musescore.exe
set DPI=130
Expand Down
Binary file modified vtest/system-4-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vtest/system-4.mscz
Binary file not shown.
Binary file added vtest/system-5-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vtest/system-5.mscz
Binary file not shown.

0 comments on commit c1b5d09

Please sign in to comment.