fix #58796: layout of one line staff

This commit is contained in:
Marc Sabatella 2015-05-20 14:16:30 -06:00 committed by ws
parent adfaf36671
commit f86fcb3e98
8 changed files with 27 additions and 5 deletions

View file

@ -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;
}
@ -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;

View file

@ -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
@ -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; }

View file

@ -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

View file

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

BIN
vtest/system-5-ref.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
vtest/system-5.mscz Normal file

Binary file not shown.