Skip to content

Commit

Permalink
preparations for new compatibility implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Sep 13, 2016
1 parent 9c79ce5 commit dae8605
Show file tree
Hide file tree
Showing 30 changed files with 1,976 additions and 457 deletions.
1 change: 1 addition & 0 deletions libmscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ add_library (
noteline.cpp spannermap.cpp
bagpembell.cpp ambitus.cpp keylist.cpp scoreElement.cpp
shape.cpp systemdivider.cpp midimapping.cpp
read114.cpp read207.cpp read300.cpp
)

set_target_properties (
Expand Down
14 changes: 7 additions & 7 deletions libmscore/chord.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ enum class PlayEventType : char {
class Chord : public ChordRest {
Q_OBJECT

Q_PROPERTY(Ms::Beam* beam READ beam)
Q_PROPERTY(Ms::Beam* beam READ beam)
Q_PROPERTY(QQmlListProperty<Ms::Chord> graceNotes READ qmlGraceNotes)
Q_PROPERTY(Ms::Hook* hook READ hook)
Q_PROPERTY(QQmlListProperty<Ms::Lyrics> lyrics READ qmlLyrics)
Q_PROPERTY(QQmlListProperty<Ms::Note> notes READ qmlNotes)
Q_PROPERTY(Ms::Stem* stem READ stem)
Q_PROPERTY(Ms::StemSlash* stemSlash READ stemSlash)
Q_PROPERTY(int stemDirection READ stemDirection)
Q_PROPERTY(Ms::Hook* hook READ hook)
Q_PROPERTY(QQmlListProperty<Ms::Lyrics> lyrics READ qmlLyrics)
Q_PROPERTY(QQmlListProperty<Ms::Note> notes READ qmlNotes)
Q_PROPERTY(Ms::Stem* stem READ stem)
Q_PROPERTY(Ms::StemSlash* stemSlash READ stemSlash)
Q_PROPERTY(int stemDirection READ stemDirection)

std::vector<Note*> _notes; // sorted to decreasing line step
LedgerLine* _ledgerLines; // single linked list
Expand Down
7 changes: 0 additions & 7 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3373,7 +3373,6 @@ void Score::timeDelete(Measure* m, Segment* startSegment, const Fraction& f)
int tick = startSegment->rtick();
int len = f.ticks();
int etick = tick + len;
// printf("cmdTimeDelete at tick %d ticks %d\n", tick, len);

Segment* fs = m->first(CR_TYPE);

Expand All @@ -3385,11 +3384,9 @@ void Score::timeDelete(Measure* m, Segment* startSegment, const Fraction& f)
int cetick = s->rtick() + cr->duration().ticks();

if (cetick <= tick) {
// printf(" %d continue %d\n", track, s->rtick());
continue;
}
if (s->rtick() >= etick) {
// printf(" %d break %d\n", track, s->rtick());
break;
}

Expand All @@ -3399,25 +3396,21 @@ void Score::timeDelete(Measure* m, Segment* startSegment, const Fraction& f)
// inside deleted area
else if (s->rtick() >= tick && cetick <= etick) {
// inside
// printf(" %d inside\n", track);
undoRemoveElement(cr);
}
else if (s->rtick() >= tick) {
// running out
// printf(" %d running out\n", track);
Fraction ff = cr->duration() - Fraction::fromTicks(cetick - etick);
undoRemoveElement(cr);
createCRSequence(ff, cr, tick + len);
}
else if (s->rtick() < tick && cetick <= etick) {
// running in
// printf(" %d running in\n", track);
Fraction f1 = Fraction::fromTicks(tick - s->tick());
changeCRlen(cr, f1, false);
}
else {
// running in/out
// printf(" %d running in/out\n", track);
Fraction f1 = cr->duration() - f;
changeCRlen(cr, f1, false);
}
Expand Down
6 changes: 6 additions & 0 deletions libmscore/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class Trill;
class TrillSegment;
class Symbol;
class FSymbol;
class Fingering;
class NoteHead;

enum class SymId;

Expand Down Expand Up @@ -736,6 +738,8 @@ class Element : public QObject, public ScoreElement {
CONVERT(TrillSegment, TRILL_SEGMENT)
CONVERT(Symbol, SYMBOL)
CONVERT(FSymbol, FSYMBOL)
CONVERT(Fingering, FINGERING)
CONVERT(NoteHead, NOTEHEAD)
#undef CONVERT
};

Expand Down Expand Up @@ -832,6 +836,8 @@ static inline const a* to##a(const Element* e) { Q_ASSERT(e == 0 || e->type() ==
CONVERT(TrillSegment, TRILL_SEGMENT)
CONVERT(Symbol, SYMBOL)
CONVERT(FSymbol, FSYMBOL)
CONVERT(Fingering, FINGERING)
CONVERT(NoteHead, NOTEHEAD)
#undef CONVERT

//---------------------------------------------------------
Expand Down
43 changes: 7 additions & 36 deletions libmscore/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,13 +1557,6 @@ void Measure::read(XmlReader& e, int staffIdx)
qreal _spatium = spatium();

QList<Chord*> graceNotes;

//sort tuplet elements. needed for nested tuplets #22537
if (score()->mscVersion() <= 114) {
for (Tuplet* t : e.tuplets()) {
t->sortElements();
}
}
e.tuplets().clear();
e.setTrack(staffIdx * VOICES);

Expand Down Expand Up @@ -1840,9 +1833,6 @@ void Measure::read(XmlReader& e, int staffIdx)
clef->setTrack(e.track());
clef->read(e);
clef->setGenerated(false);
// in some 1.3 scores, clefs can be in score but not in cleflist
// if (score()->mscVersion() > 114)
// staff->setClef(e.tick(), clef->clefTypeList());

// there may be more than one clef segment for same tick position
if (!segment) {
Expand Down Expand Up @@ -1910,15 +1900,13 @@ void Measure::read(XmlReader& e, int staffIdx)
timeStretch = ts->stretch().reduced();
_timesig = ts->sig() / timeStretch;

if (score()->mscVersion() > 114) {
if (irregular) {
score()->sigmap()->add(tick(), SigEvent(_len, _timesig));
score()->sigmap()->add(tick() + ticks(), SigEvent(_timesig));
}
else {
_len = _timesig;
score()->sigmap()->add(tick(), SigEvent(_timesig));
}
if (irregular) {
score()->sigmap()->add(tick(), SigEvent(_len, _timesig));
score()->sigmap()->add(tick() + ticks(), SigEvent(_timesig));
}
else {
_len = _timesig;
score()->sigmap()->add(tick(), SigEvent(_timesig));
}
}
}
Expand All @@ -1945,19 +1933,6 @@ void Measure::read(XmlReader& e, int staffIdx)
staff->setKey(curTick, ks->keySigEvent());
}
}
else if (tag == "Lyrics") { // obsolete, keep for compatibility with version 114
Element* element = Element::name2Element(tag, score());
element->setTrack(e.track());
element->read(e);
segment = getSegment(Segment::Type::ChordRest, e.tick());
ChordRest* cr = static_cast<ChordRest*>(segment->element(element->track()));
if (!cr)
cr = static_cast<ChordRest*>(segment->element(e.track())); // in case lyric itself has bad track info
if (!cr)
qDebug("Internal error: no chord/rest for lyrics");
else
cr->add(element);
}
else if (tag == "Text") {
Text* t = new StaffText(score());
t->setTrack(e.track());
Expand All @@ -1979,8 +1954,6 @@ void Measure::read(XmlReader& e, int staffIdx)
Dynamic* dyn = new Dynamic(score());
dyn->setTrack(e.track());
dyn->read(e);
if (score()->mscVersion() <= 114)
dyn->setDynamicType(dyn->xmlText());
segment = getSegment(Segment::Type::ChordRest, e.tick());
segment->add(dyn);
}
Expand All @@ -1998,8 +1971,6 @@ void Measure::read(XmlReader& e, int staffIdx)
Element* el = Element::name2Element(tag, score());
// hack - needed because tick tags are unreliable in 1.3 scores
// for symbols attached to anything but a measure
if (score()->mscVersion() <= 114 && el->type() == Element::Type::SYMBOL)
el->setParent(this); // this will get reset when adding to segment
el->setTrack(e.track());
el->read(e);
segment = getSegment(Segment::Type::ChordRest, e.tick());
Expand Down
7 changes: 5 additions & 2 deletions libmscore/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

namespace Ms {

#define MSC_VERSION "2.07"
static constexpr int MSCVERSION = 207;
#define MSC_VERSION "3.00"
static constexpr int MSCVERSION = 300;

// History:
// 1.3 added staff->_barLineSpan
Expand All @@ -33,6 +33,7 @@ static constexpr int MSCVERSION = 207;
// 1.12 use durationType, remove tickLen
// 1.13 Clefs: userOffset is not (mis)used for vertical layout position
// 1.14 save user modified beam position as spatium value (Versions 0.9.6 - 1.3)

// 1.15 save timesig inline; Lyrics "endTick" replaced by "ticks"
// 1.16 spanners (hairpin, trill etc.) are now inline and have no ticks anymore
// 1.17 new <Score> toplevel structure to support linked parts (excerpts)
Expand All @@ -47,6 +48,7 @@ static constexpr int MSCVERSION = 207;
// 1.24 default image size is spatium dependent
// - symbol numbers in TextLine() replaced by symbol names
// TextStyle: frameWidth, paddingWidth are now in Spatium units (instead of mm)

// 2.00 (Version 2.0)
// 2.01 save SlurSegment position relative to staff
// 2.02 save instrumentId, note slashes
Expand All @@ -57,6 +59,7 @@ static constexpr int MSCVERSION = 207;
//
// 2.07 irregular, breakMMrest, more style options, system divider, bass string for tab (3.0)

// 3.00 (Version 3.0 alpha)

class MStyle;
class Sequencer;
Expand Down
Loading

0 comments on commit dae8605

Please sign in to comment.