ec3be9a99a
- tick names a position on the time axis - tick is always a Fraction() - only Measure() and Segment() (and Tuplet?) have a tick value - tick() for an generic element return only a sensible value if isMeasure() or isSegment() or isSegment(parent()) - "ticks" names a duration stored in a Fraction() - the tick value for an Segment is relative to its measure - rename "duration" to "ticks" - rename afrac() to tick() - rename rfrac() to rtick() - rename some variables, changing "fraction" into "tick" (example: actualFraction() into actualTicks()) - Lyrics ticks are written as Fraction, on read if xmlreader sees a "/" it reads a fraction else midi ticks for backwards compatibility
101 lines
2.6 KiB
C++
101 lines
2.6 KiB
C++
//=============================================================================
|
|
// MuseScore
|
|
// Music Composition & Notation
|
|
//
|
|
// Copyright (C) 2012 Werner Schweer
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License version 2
|
|
// as published by the Free Software Foundation and appearing in
|
|
// the file LICENCE.GPL
|
|
//=============================================================================
|
|
|
|
#ifndef __DURATIONLIST_H__
|
|
#define __DURATIONLIST_H__
|
|
|
|
#include "fraction.h"
|
|
|
|
namespace Ms {
|
|
|
|
class Element;
|
|
class Measure;
|
|
class Tuplet;
|
|
class Segment;
|
|
class Spanner;
|
|
class ScoreRange;
|
|
class ChordRest;
|
|
class Score;
|
|
|
|
//---------------------------------------------------------
|
|
// TrackList
|
|
//---------------------------------------------------------
|
|
|
|
class TrackList : public QList<Element*>
|
|
{
|
|
Fraction _duration;
|
|
ScoreRange* _range;
|
|
int _track;
|
|
|
|
Tuplet* writeTuplet(Tuplet* parent, Tuplet* tuplet, Measure*& measure, Fraction& rest) const;
|
|
void append(Element*);
|
|
void appendTuplet(Tuplet* srcTuplet, Tuplet* dstTuplet);
|
|
void combineTuplet(Tuplet* dst, Tuplet* src);
|
|
|
|
public:
|
|
TrackList(ScoreRange* r) { _range = r; }
|
|
~TrackList();
|
|
|
|
Fraction ticks() const { return _duration; }
|
|
ScoreRange* range() const { return _range; }
|
|
|
|
int track() const { return _track; }
|
|
void setTrack(int val) { _track = val; }
|
|
|
|
void read(const Segment* fs, const Segment* ls);
|
|
bool write(Score*, const Fraction&) const;
|
|
|
|
void appendGap(const Fraction&);
|
|
bool truncate(const Fraction&);
|
|
void dump() const;
|
|
};
|
|
|
|
//---------------------------------------------------------
|
|
// Annotation
|
|
//---------------------------------------------------------
|
|
|
|
struct Annotation {
|
|
Fraction tick;
|
|
Element* e;
|
|
};
|
|
|
|
//---------------------------------------------------------
|
|
// ScoreRange
|
|
//---------------------------------------------------------
|
|
|
|
class ScoreRange {
|
|
QList<TrackList*> tracks;
|
|
Segment* _first;
|
|
Segment* _last;
|
|
|
|
protected:
|
|
QList<Spanner*> spanner;
|
|
QList<Annotation> annotations;
|
|
|
|
public:
|
|
ScoreRange() {}
|
|
~ScoreRange();
|
|
void read(Segment* first, Segment* last, bool readSpanner = true);
|
|
bool write(Score*, const Fraction&) const;
|
|
Fraction ticks() const;
|
|
Segment* first() const { return _first; }
|
|
Segment* last() const { return _last; }
|
|
void fill(const Fraction&);
|
|
bool truncate(const Fraction&);
|
|
|
|
friend class TrackList;
|
|
};
|
|
|
|
|
|
} // namespace Ms
|
|
#endif
|
|
|