Skip to content

Commit

Permalink
honor maxSystemDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Aug 11, 2017
1 parent ae60d40 commit a66d69a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
12 changes: 10 additions & 2 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,8 @@ static void layoutPage(Page* page, qreal restHeight)

std::sort(sList.begin(), sList.end(), [](System* a, System* b) { return a->distance() < b->distance(); });

qreal maxDist = score->styleP(StyleIdx::maxSystemDistance);

qreal dist = sList[0]->distance();
for (int i = 1; i < sList.size(); ++i) {
qreal ndist = sList[i]->distance();
Expand All @@ -1483,7 +1485,10 @@ static void layoutPage(Page* page, qreal restHeight)
}
for (int k = 0; k < i; ++k) {
System* s = sList[k];
s->setDistance(s->distance() + fill);
qreal d = s->distance() + fill;
if ((d - s->height()) > maxDist)
d = qMax(maxDist + s->height(), s->distance());
s->setDistance(d);
}
restHeight -= totalFill;
if (restHeight <= 0)
Expand All @@ -1494,7 +1499,10 @@ static void layoutPage(Page* page, qreal restHeight)
qreal fill = restHeight / sList.size();
for (int i = 0; i < sList.size(); ++i) {
System* s = sList[i];
s->setDistance(s->distance() + fill);
qreal d = s->distance() + fill;
if ((d - s->height()) > maxDist)
d = qMax(maxDist + s->height(), s->distance());
s->setDistance(d);
}
}

Expand Down
24 changes: 21 additions & 3 deletions mscore/editstyle.ui
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</widget>
<widget class="QStackedWidget" name="pageStack">
<property name="currentIndex">
<number>28</number>
<number>1</number>
</property>
<widget class="QWidget" name="PageScore">
<layout class="QVBoxLayout" name="verticalLayout_20">
Expand Down Expand Up @@ -636,6 +636,9 @@
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
Expand Down Expand Up @@ -687,6 +690,9 @@
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
Expand Down Expand Up @@ -767,7 +773,7 @@
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.500000000000000</double>
</property>
</widget>
</item>
Expand Down Expand Up @@ -807,6 +813,9 @@
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
Expand Down Expand Up @@ -845,6 +854,9 @@
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="4" column="4">
Expand Down Expand Up @@ -883,6 +895,9 @@
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="10" column="0">
Expand Down Expand Up @@ -939,11 +954,14 @@
<number>1</number>
</property>
<property name="minimum">
<double>-1000.000000000000000</double>
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="2" column="4">
Expand Down

0 comments on commit a66d69a

Please sign in to comment.