fix layout regression

This commit is contained in:
Werner Schweer 2012-06-11 12:15:21 +02:00
parent 6dbce9b5bc
commit 5985ab5a56
5 changed files with 39 additions and 8 deletions

View file

@ -927,7 +927,6 @@ bool Score::layoutSystem(qreal& minWidth, qreal w, bool isFirstSystem, bool long
System* oldSystem = curMeasure->system();
curMeasure->setSystem(system);
qreal ww = 0.0;
qreal stretch = 0.0;
if (curMeasure->type() == HBOX) {
ww = point(static_cast<Box*>(curMeasure)->boxWidth());
@ -958,9 +957,29 @@ bool Score::layoutSystem(qreal& minWidth, qreal w, bool isFirstSystem, bool long
m->createEndBarLines(); // TODO: not set here
m->layoutX(1.0, true);
ww = m->layoutWidth();
stretch = m->userStretch() * styleD(ST_measureSpacing);
ww = m->layoutWidth();
if (!isFirstMeasure) {
// remove width of generated system header
Segment* seg = m->first();
if ((seg->subtype() == SegClef) && seg->element(0)->generated()) {
ww -= seg->width();
seg = seg->next();
if (seg && (seg->subtype() == SegKeySig) && seg->element(0)->generated())
ww -= seg->width();
}
}
// add width for EndBarLine
Segment* seg = m->last();
if (seg->subtype() == SegEndBarLine) {
BarLine* bl = static_cast<BarLine*>(seg->element(0));
if (m->repeatFlags() & RepeatEnd) {
if (bl && (bl->subtype() != END_REPEAT)) {
// printf("BarLine type does not fit\n");
ww += spatium(); // HACK
}
}
}
qreal stretch = m->userStretch() * styleD(ST_measureSpacing);
ww *= stretch;
if (ww < point(styleS(ST_minMeasureWidth)))
ww = point(styleS(ST_minMeasureWidth));

View file

@ -3008,11 +3008,13 @@ void Measure::layoutX(qreal stretch, bool firstPass)
if (firstPass) {
// qDebug("this is pass 1");
_mw = xpos[segs];
if (types[0] == SegClef && first()->element(0)->generated()) {
#if 0
if (!firstMeasure && (types[0] == SegClef) && first()->element(0)->generated()) {
_mw -= width[0];
if ((segs > 2) && (types[1] == SegKeySig) && first()->next()->element(0)->generated())
_mw -= width[1];
}
#endif
_dirty = false;
return;
}

View file

@ -631,11 +631,21 @@ bool Score::loadCompressedMsc(QString name)
imageStore.add(s, dbuf);
}
if (rootfile.isEmpty()) {
qDebug("can't find rootfile in: %s\n", qPrintable(name));
qDebug("can't find rootfile in: %s", qPrintable(name));
return false;
}
QByteArray dbuf = uz.fileData(rootfile);
if (dbuf.isEmpty()) {
qDebug("root file <%s> is empty", qPrintable(rootfile));
QList<QZipReader::FileInfo> fil = uz.fileInfoList();
foreach(const QZipReader::FileInfo& fi, fil) {
if (fi.isFile && fi.filePath.endsWith(".mscx")) {
dbuf = uz.fileData(fi.filePath);
break;
}
}
}
QDomDocument doc;
if (!doc.setContent(dbuf, false, &err, &line, &column)) {

View file

@ -82,7 +82,7 @@ void SegmentList::check()
void SegmentList::insert(Segment* e, Segment* el)
{
if (e->score()->undoRedo())
qFatal("SegmentList:insert in undo/redo");
qDebug("SegmentList:insert in undo/redo");
if (el == 0)
push_back(e);
else if (el == first())

View file

@ -48,7 +48,7 @@ Xml::Xml()
Xml::Xml(QIODevice* device)
: QTextStream(device)
{
setCodec("utf8");
setCodec("UTF-8");
stack.clear();
curTick = 0;
curTrack = -1;