Skip to content

Commit

Permalink
Merge pull request #5477 from MarcSabatella/281253-spacer-down-system
Browse files Browse the repository at this point in the history
fix #281253: staff spacer down ignored on bottom of page
  • Loading branch information
dmitrio95 committed Dec 5, 2019
2 parents 90be292 + 10b3da9 commit d243bce
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 19 deletions.
31 changes: 17 additions & 14 deletions libmscore/system.cpp
Expand Up @@ -1285,28 +1285,30 @@ qreal System::bottomDistance(int staffIdx, const SkylineLine& s) const
// firstVisibleSysStaff
//---------------------------------------------------------

SysStaff* System::firstVisibleSysStaff() const
int System::firstVisibleSysStaff() const
{
for (SysStaff* s : _staves) {
if (s->show())
return s;
int nstaves = _staves.size();
for (int i = 0; i < nstaves; ++i) {
if (_staves[i]->show())
return i;
}
qDebug("no sys staff");
return 0;
return -1;
}

//---------------------------------------------------------
// lastVisibleSysStaff
//---------------------------------------------------------

SysStaff* System::lastVisibleSysStaff() const
int System::lastVisibleSysStaff() const
{
for (int i = _staves.size() - 1; i >= 0; --i) {
int nstaves = _staves.size();
for (int i = nstaves - 1; i >= 0; --i) {
if (_staves[i]->show())
return _staves[i];
return i;
}
qDebug("no sys staff");
return 0;
return -1;
}

//---------------------------------------------------------
Expand All @@ -1316,7 +1318,8 @@ SysStaff* System::lastVisibleSysStaff() const

qreal System::minTop() const
{
SysStaff* s = firstVisibleSysStaff();
int si = firstVisibleSysStaff();
SysStaff* s = si < 0 ? nullptr : staff(si);
if (s)
return -s->skyline().north().max();
return 0.0;
Expand All @@ -1331,7 +1334,8 @@ qreal System::minBottom() const
{
if (vbox())
return vbox()->bottomGap();
SysStaff* s = lastVisibleSysStaff();
int si = lastVisibleSysStaff();
SysStaff* s = si < 0 ? nullptr : staff(si);
if (s)
return s->skyline().south().max() - s->bbox().height();
return 0.0;
Expand All @@ -1344,11 +1348,10 @@ qreal System::minBottom() const

qreal System::spacerDistance(bool up) const
{
SysStaff* ss = up ? firstVisibleSysStaff() : lastVisibleSysStaff();
if (!ss)
int staff = up ? firstVisibleSysStaff() : lastVisibleSysStaff();
if (staff < 0)
return 0.0;
qreal dist = 0.0;
int staff = ss->idx;
for (MeasureBase* mb : measures()) {
if (mb->isMeasure()) {
Measure* m = toMeasure(mb);
Expand Down
6 changes: 3 additions & 3 deletions libmscore/system.h
Expand Up @@ -51,7 +51,7 @@ class SysStaff {
bool _show { true }; // derived from Staff or false if empty
// staff is hidden
public:
int idx { 0 };
//int idx { 0 };
QList<InstrumentName*> instrumentNames;

const QRectF& bbox() const { return _bbox; }
Expand Down Expand Up @@ -89,8 +89,8 @@ class System final : public Element {
mutable bool fixedDownDistance { false };
qreal _distance; // temp. variable used during layout

SysStaff* firstVisibleSysStaff() const;
SysStaff* lastVisibleSysStaff() const;
int firstVisibleSysStaff() const;
int lastVisibleSysStaff() const;

int getBracketsColumnsCount();
void setBracketsXPosition(const qreal xOffset);
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen
Expand Up @@ -58,7 +58,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 lyrics-7 lyrics-8 voice-1 voice-2 slash-1 slash-2\
system-1 system-2 system-3 system-4 system-5 system-6 system-7 hide-1 small-1 tremolo-1\
system-1 system-2 system-3 system-4 system-5 system-6 system-7 system-8 hide-1 small-1 tremolo-1\
staff-1 staff-2 layout-1 layout-2 layout-3 layout-4 layout-5 layout-6 layout-7 layout-8 layout-9 layout-10\
articulation-1\
percussion-grace\
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen.bat
Expand Up @@ -36,7 +36,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,lyrics-7,lyrics-8,voice-1,voice-2,slash-1,slash-2, ^
system-1,system-2,system-3,system-4,system-5,system-6,system-7,hide-1,small-1,tremolo-1, ^
system-1,system-2,system-3,system-4,system-5,system-6,system-7,system-8,hide-1,small-1,tremolo-1, ^
staff-1,staff-2,layout-1,layout-2,layout-3,layout-4,layout-5,layout-6,layout-7,layout-8,layout-9,layout-10, ^
articulation-1, ^
percussion-grace, ^
Expand Down

0 comments on commit d243bce

Please sign in to comment.