fix local layout feature

This commit is contained in:
ws 2016-04-07 11:18:34 +02:00
parent 097ac65733
commit 0382b6898e
6 changed files with 12 additions and 29 deletions

View file

@ -506,7 +506,7 @@ void Beam::layout()
qreal lw2 = score()->styleP(StyleIdx::beamWidth) * .5 * mag();
ChordRest* cr = crl.front();
// Shape& s = cr->segment()->shape(staffIdx());
QPointF offset = cr->pos() + cr->segment()->pos() + cr->segment()->measure()->pos();
// QPointF offset = cr->pos() + cr->segment()->pos() + cr->segment()->measure()->pos();
for (const QLineF* bs : beamSegments) {
QPolygonF a(4);
@ -1495,8 +1495,8 @@ void Beam::computeStemLen(const std::vector<ChordRest*>& cl, qreal& py1, int bea
void Beam::layout2(std::vector<ChordRest*>crl, SpannerSegmentType, int frag)
{
//TODO-ws if (_distribute)
// score()->respace(&crl); // fix horizontal spacing of stems
if (_distribute)
score()->respace(&crl); // fix horizontal spacing of stems
if (crl.empty()) // no beamed Elements
return;

View file

@ -1994,9 +1994,8 @@ qreal sff2(qreal x, qreal xMin, const SpringMap2& springs)
// respace
//---------------------------------------------------------
void Score::respace(QList<ChordRest*>* /*elements*/)
void Score::respace(std::vector<ChordRest*>* elements)
{
#if 0
ChordRest* cr1 = elements->front();
ChordRest* cr2 = elements->back();
int n = elements->size();
@ -2009,11 +2008,9 @@ void Score::respace(QList<ChordRest*>* /*elements*/)
for (int i = 0; i < n-1; ++i) {
ChordRest* cr = (*elements)[i];
ChordRest* ncr = (*elements)[i+1];
Space space(cr->space());
Space nspace(ncr->space());
width[i] = space.rw() + nspace.lw();
ticksList[i] = ncr->segment()->tick() - cr->segment()->tick();
ChordRest* ncr = (*elements)[i+1];
width[i] = cr->shape().minHorizontalDistance(ncr->shape());
ticksList[i] = cr->duration().ticks();
minTick = qMin(ticksList[i], minTick);
}
@ -2026,7 +2023,6 @@ void Score::respace(QList<ChordRest*>* /*elements*/)
for (int i = 0; i < n-1; ++i) {
qreal w = width[i];
int t = ticksList[i];
// qreal str = 1.0 + .6 * log(qreal(t) / qreal(minTick)) / log(2.0);
qreal str = 1.0 + 0.865617 * log(qreal(t) / qreal(minTick));
qreal d = w / str;
@ -2052,7 +2048,6 @@ void Score::respace(QList<ChordRest*>* /*elements*/)
qreal dx = x - cr->segment()->pos().x();
cr->rxpos() += dx;
}
#endif
}
//---------------------------------------------------------

View file

@ -975,7 +975,7 @@ class Score : public QObject, public ScoreElement {
Tuplet* searchTuplet(XmlReader& e, int id);
void cmdSelectAll();
void cmdSelectSection();
void respace(QList<ChordRest*>* elements);
void respace(std::vector<ChordRest*>* elements);
void transposeSemitone(int semitone);
MeasureBase* insertMeasure(Element::Type type, MeasureBase*,
bool createEmptyMeasures = false);

View file

@ -52,26 +52,14 @@ else
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 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\
staff-1 staff-2 layout-1 layout-2"
staff-1 staff-2 layout-1 layout-2 layout-3 layout-4"
fi
#####DEBUG: failed tests
#SRC=" \
# emmentaler-8 bravura-8 gonville-8
# emmentaler-10
# emmentaler-text-2
# musejazz-text-2
# line-2
# chord-layout-15
# accidental-2
# grace-1
# grace-2
# harmony-12\
# user-offset-2 \
# "
# layout-1 layout-2
# system-4"
SRC=" \
layout-1 layout-2 layout-3 layout-4
system-4"
DPI=130
F=vtest.html

BIN
vtest/layout-3.mscz Normal file

Binary file not shown.

BIN
vtest/layout-4.mscz Normal file

Binary file not shown.