MuseScore/libmscore/range.h

92 lines
2.4 KiB
C
Raw Normal View History

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;
//---------------------------------------------------------
// TrackList
//---------------------------------------------------------
class TrackList : public QList<Element*>
{
Fraction _duration;
ScoreRange* _range;
Tuplet* writeTuplet(Tuplet* tuplet, Measure* measure, int tick) const;
2013-06-19 16:25:29 +02:00
void append(Element*);
2012-05-26 14:26:10 +02:00
public:
TrackList(ScoreRange* r) { _range = r; }
~TrackList();
2013-06-19 16:25:29 +02:00
void read(int track, const Segment* fs, const Segment* ls);
2012-05-26 14:26:10 +02:00
bool canWrite(const Fraction& f) const;
2013-06-19 16:25:29 +02:00
bool write(int track, Measure*) const;
2012-05-26 14:26:10 +02:00
Fraction duration() const { return _duration; }
ScoreRange* range() const { return _range; }
void appendGap(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();
void read(Segment* first, Segment* last, int startTrack, int endTrack);
bool canWrite(const Fraction&) const;
bool write(int track, Measure*) const;
Fraction duration() const;
Segment* first() const { return _first; }
Segment* last() const { return _last; }
void fill(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