From 4a098252fc9c2d9103c1b164eb0ff445aa8a2b50 Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Thu, 23 Aug 2012 12:28:27 +0200 Subject: [PATCH] enhanced 1.2 import --- Compatibility | 7 ++++--- libmscore/beam.cpp | 9 ++++++--- libmscore/imageStore.cpp | 3 ++- libmscore/read114.cpp | 34 +++++++++++++++++++++++++++++++++- mscore/file.cpp | 3 +-- 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/Compatibility b/Compatibility index 941cba8b36..f5d39cbd8f 100644 --- a/Compatibility +++ b/Compatibility @@ -1,9 +1,10 @@ Compatibility with 1.2 scores -- In 1.2 beams cannot span measures. "Begin Beam" markings are ignored. - In 2.0 the marking is honored. +* In 1.2 beams cannot span measures. "Middle Beam" markings are ignored in + this case. In 2.0 the marking is honored. Bug: the current implementation does not handle beams spanning pages. The resulting layout is undefined. - + (Fixed by replacing "Middle Beam" markings at the beginning of a Measure + by "Beam Begin" marking) diff --git a/libmscore/beam.cpp b/libmscore/beam.cpp index 3d83a86fa4..3192c3aa8e 100644 --- a/libmscore/beam.cpp +++ b/libmscore/beam.cpp @@ -453,8 +453,7 @@ bool Beam::twoBeamedNotes() void Beam::layout1() { //delete old segments - foreach(QLineF* i, beamSegments) - delete i; + qDeleteAll(beamSegments); beamSegments.clear(); maxDuration.setType(TDuration::V_INVALID); @@ -1728,7 +1727,11 @@ void Beam::layout2(QListcrl, SpannerSegmentType, int frag) qreal yo = py1 + bl * _beamDist * _grow1; qreal ly1 = (x2 - x1) * slope + yo; qreal ly2 = (x3 - x1) * slope + yo; - beamSegments.push_back(new QLineF(x2, ly1, x3, ly2)); + if (!qIsFinite(x2) || !qIsFinite(ly1) + || !qIsFinite(x3) || !qIsFinite(ly2)) + qDebug("bad beam segment"); + else + beamSegments.push_back(new QLineF(x2, ly1, x3, ly2)); --i; } } diff --git a/libmscore/imageStore.cpp b/libmscore/imageStore.cpp index 447e31f941..dd406d3808 100644 --- a/libmscore/imageStore.cpp +++ b/libmscore/imageStore.cpp @@ -153,7 +153,8 @@ ImageStoreItem* ImageStore::getImage(const QString& path) const if (item->path() == path) return item; } - qDebug("ImageStore::getImage(): bad base name <%s>", qPrintable(s)); + qDebug("ImageStore::getImage(%s): bad base name <%s>", + qPrintable(path), qPrintable(s)); return 0; } QByteArray hash(16, 0); diff --git a/libmscore/read114.cpp b/libmscore/read114.cpp index 283eefcc4b..ebad3eb623 100644 --- a/libmscore/read114.cpp +++ b/libmscore/read114.cpp @@ -354,7 +354,39 @@ bool Score::read114(const QDomElement& de) spanner.clear(); connectTies(); - searchSelectedElements(); +// searchSelectedElements(); + + for(Measure* m = firstMeasure(); m; m = m->nextMeasure()) { + int tracks = nstaves() * VOICES; + for (int track = 0; track < tracks; ++track) { + for (Segment* s = m->first(); s; s = s->next()) { + if (s->subtype() != Segment::SegChordRest) + continue; + ChordRest* cr = static_cast(s->element(track)); + if (cr) { + switch(cr->beamMode()) { + case BEAM_AUTO: + case BEAM_BEGIN: + case BEAM_END: + case BEAM_NO: + break; + case BEAM_MID: + case BEAM_BEGIN32: + case BEAM_BEGIN64: + cr->setBeamMode(BEAM_BEGIN); + break; + case BEAM_INVALID: + if (cr->type() == CHORD) + cr->setBeamMode(BEAM_AUTO); + else + cr->setBeamMode(BEAM_NO); + break; + } + break; + } + } + } + } _fileDivision = MScore::division; diff --git a/mscore/file.cpp b/mscore/file.cpp index 67c7936380..87b9df3fdb 100644 --- a/mscore/file.cpp +++ b/mscore/file.cpp @@ -1086,8 +1086,7 @@ QString MuseScore::getFotoFilename() if (myImages.isRelative()) myImages.setFile(QDir::home(), preferences.myImagesPath); QList urls; - QString home = QDir::homePath(); - urls.append(QUrl::fromLocalFile(home)); + urls.append(QUrl::fromLocalFile(QDir::homePath())); urls.append(QUrl::fromLocalFile(myImages.absoluteFilePath())); urls.append(QUrl::fromLocalFile(QDir::currentPath()));