2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// 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"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class Element;
|
|
|
|
class Measure;
|
|
|
|
class Tuplet;
|
|
|
|
class Segment;
|
|
|
|
class Spanner;
|
|
|
|
class ScoreRange;
|
|
|
|
class ChordRest;
|
2014-05-14 19:19:29 +02:00
|
|
|
class Score;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// TrackList
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class TrackList : public QList<Element*>
|
|
|
|
{
|
|
|
|
Fraction _duration;
|
|
|
|
ScoreRange* _range;
|
2014-11-13 11:53:42 +01:00
|
|
|
int _track;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-11-28 17:25:26 +01:00
|
|
|
Tuplet* writeTuplet(Tuplet* parent, Tuplet* tuplet, Measure*& measure, Fraction& rest) const;
|
2013-06-19 16:25:29 +02:00
|
|
|
void append(Element*);
|
2016-11-28 17:25:26 +01:00
|
|
|
void appendTuplet(Tuplet* srcTuplet, Tuplet* dstTuplet);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
TrackList(ScoreRange* r) { _range = r; }
|
|
|
|
~TrackList();
|
2014-11-13 11:53:42 +01:00
|
|
|
|
2016-11-28 17:25:26 +01:00
|
|
|
Fraction duration() const { return _duration; }
|
|
|
|
ScoreRange* range() const { return _range; }
|
|
|
|
|
2014-11-13 11:53:42 +01:00
|
|
|
int track() const { return _track; }
|
|
|
|
void setTrack(int val) { _track = val; }
|
2016-11-28 17:25:26 +01:00
|
|
|
|
2014-11-13 11:53:42 +01:00
|
|
|
void read(const Segment* fs, const Segment* ls);
|
2012-05-26 14:26:10 +02:00
|
|
|
bool canWrite(const Fraction& f) const;
|
2016-12-03 13:46:58 +01:00
|
|
|
bool write(Score*, int tick) const;
|
2016-11-28 17:25:26 +01:00
|
|
|
|
2012-06-26 14:41:49 +02:00
|
|
|
void appendGap(const Fraction&);
|
2016-12-03 13:46:58 +01:00
|
|
|
bool truncate(const Fraction&);
|
2013-06-10 11:03:34 +02:00
|
|
|
void dump() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-06-19 16:25:29 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// Annotation
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
struct Annotation {
|
|
|
|
int tick;
|
|
|
|
Element* e;
|
|
|
|
};
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// ScoreRange
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class ScoreRange {
|
|
|
|
QList<TrackList*> tracks;
|
|
|
|
Segment* _first;
|
|
|
|
Segment* _last;
|
|
|
|
|
2013-06-19 16:25:29 +02:00
|
|
|
protected:
|
|
|
|
QList<Spanner*> spanner;
|
|
|
|
QList<Annotation> annotations;
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
ScoreRange() {}
|
|
|
|
~ScoreRange();
|
2014-05-14 19:19:29 +02:00
|
|
|
void read(Segment* first, Segment* last);
|
2012-05-26 14:26:10 +02:00
|
|
|
bool canWrite(const Fraction&) const;
|
2014-05-14 19:19:29 +02:00
|
|
|
bool write(Score*, int tick) const;
|
2012-05-26 14:26:10 +02:00
|
|
|
Fraction duration() const;
|
|
|
|
Segment* first() const { return _first; }
|
|
|
|
Segment* last() const { return _last; }
|
2012-06-26 14:41:49 +02:00
|
|
|
void fill(const Fraction&);
|
2016-12-03 13:46:58 +01:00
|
|
|
bool truncate(const Fraction&);
|
2013-06-19 16:25:29 +02:00
|
|
|
|
|
|
|
friend class TrackList;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|