another multi measure rest layout fix
This commit is contained in:
parent
7724169f97
commit
6c735b8798
3 changed files with 55 additions and 42 deletions
|
@ -3745,14 +3745,55 @@ void Measure::setStretchedWidth(qreal w)
|
|||
qreal minWidth = score()->styleP(StyleIdx::minMeasureWidth);
|
||||
if (w < minWidth)
|
||||
w = minWidth;
|
||||
qreal stretchableWidth = 0.0;
|
||||
for (Segment* s = first(SegmentType::ChordRest); s; s = s->next(SegmentType::ChordRest)) {
|
||||
stretchableWidth += s->width();
|
||||
|
||||
// multi measure rests are not stretched depending on their
|
||||
// tick length
|
||||
|
||||
if (!isMMRest()) {
|
||||
qreal stretchableWidth = 0.0;
|
||||
for (Segment* s = first(SegmentType::ChordRest); s; s = s->next(SegmentType::ChordRest)) {
|
||||
if (!s->enabled())
|
||||
continue;
|
||||
stretchableWidth += s->width();
|
||||
}
|
||||
w += stretchableWidth * (basicStretch()-1.0) * ticks() / 1920.0;
|
||||
}
|
||||
w += stretchableWidth * (basicStretch()-1.0) * ticks() / 1920.0;
|
||||
setWidth(w);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// hasAccidental
|
||||
//---------------------------------------------------------
|
||||
|
||||
static bool hasAccidental(Segment* s)
|
||||
{
|
||||
for (int track = 0; track < s->score()->ntracks(); ++track) {
|
||||
Element* e = s->element(track);
|
||||
if (!e || !e->isChord())
|
||||
continue;
|
||||
Chord* c = toChord(e);
|
||||
for (Note* n : c->notes()) {
|
||||
if (n->accidental())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// dumpMeasure
|
||||
//---------------------------------------------------------
|
||||
|
||||
#ifndef NDEBUG
|
||||
static void dumpMeasure(Measure* m)
|
||||
{
|
||||
printf("Measure tick %d width %f\n", m->tick(), m->width());
|
||||
for (Segment* s = m->first(); s; s = s->next()) {
|
||||
printf(" %04d %16s %f %f\n", s->rtick(), s->subTypeName(), s->x(), s->width());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------
|
||||
// computeMinWidth
|
||||
// sets the minimum stretched width of segment list s
|
||||
|
@ -3833,25 +3874,6 @@ void Measure::computeMinWidth(Segment* s, qreal x, bool isSystemHeader)
|
|||
setStretchedWidth(x);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// hasAccidental
|
||||
//---------------------------------------------------------
|
||||
|
||||
static bool hasAccidental(Segment* s)
|
||||
{
|
||||
for (int track = 0; track < s->score()->ntracks(); ++track) {
|
||||
Element* e = s->element(track);
|
||||
if (!e || !e->isChord())
|
||||
continue;
|
||||
Chord* c = toChord(e);
|
||||
for (Note* n : c->notes()) {
|
||||
if (n->accidental())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Measure::computeMinWidth()
|
||||
{
|
||||
Segment* s;
|
||||
|
|
|
@ -346,8 +346,10 @@ void Rest::layout()
|
|||
return;
|
||||
for (Element* e : el())
|
||||
e->layout();
|
||||
qreal _spatium = spatium();
|
||||
if (measure() && measure()->isMMRest()) {
|
||||
_mmWidth = score()->styleP(StyleIdx::minMMRestWidth) * mag();
|
||||
// setbbox(QRectF(0.0, -_spatium, _mmWidth, 2.0 * _spatium));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -388,7 +390,6 @@ void Rest::layout()
|
|||
|
||||
dotline = Rest::getDotline(durationType().type());
|
||||
|
||||
qreal _spatium = spatium();
|
||||
qreal yOff = userOff().y();
|
||||
Staff* stf = staff();
|
||||
StaffType* st = stf->staffType(tick());
|
||||
|
@ -923,16 +924,14 @@ Shape Rest::shape() const
|
|||
qreal _spatium = spatium();
|
||||
shape.add(QRectF(0.0, -_spatium, _mmWidth, 2.0 * _spatium));
|
||||
|
||||
if (_mmWidth > 0.1) {
|
||||
int n = measure()->mmRestCount();
|
||||
std::vector<SymId>&& s = toTimeSigString(QString("%1").arg(n));
|
||||
qreal x = _mmWidth * .5;
|
||||
qreal y = -_spatium * 1.5 - staff()->height() *.5;
|
||||
QRectF r = symBbox(s);
|
||||
x -= r.width() * .5;
|
||||
r.translate(QPointF(x, y));
|
||||
shape.add(r);
|
||||
}
|
||||
int n = measure()->mmRestCount();
|
||||
std::vector<SymId>&& s = toTimeSigString(QString("%1").arg(n));
|
||||
qreal x = _mmWidth * .5;
|
||||
qreal y = -_spatium * 1.5 - staff()->height() *.5;
|
||||
QRectF r = symBbox(s);
|
||||
x -= r.width() * .5;
|
||||
r.translate(QPointF(x, y));
|
||||
shape.add(r);
|
||||
}
|
||||
else
|
||||
shape.add(bbox());
|
||||
|
|
|
@ -56,10 +56,6 @@
|
|||
</Staff>
|
||||
<trackName>Flute</trackName>
|
||||
<Instrument>
|
||||
<shortName>
|
||||
<html><head><meta name="qrichtext" content="1"></meta><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Fl.</p></body></html></shortName>
|
||||
<trackName>Flute</trackName>
|
||||
<minPitchP>59</minPitchP>
|
||||
<maxPitchP>98</maxPitchP>
|
||||
|
@ -97,10 +93,6 @@ p, li { white-space: pre-wrap; }
|
|||
</Staff>
|
||||
<trackName>Drumset</trackName>
|
||||
<Instrument>
|
||||
<shortName>
|
||||
<html><head><meta name="qrichtext" content="1"></meta><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Drs.</p></body></html></shortName>
|
||||
<trackName>Drumset</trackName>
|
||||
<useDrumset>1</useDrumset>
|
||||
<Drum pitch="35">
|
||||
|
|
Loading…
Reference in a new issue