MuseScore/libmscore/range.h

102 lines
2.6 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;
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;
int _track { 0 };
2012-05-26 14:26:10 +02:00
Tuplet* writeTuplet(Tuplet* parent, Tuplet* tuplet, Measure*& measure, Fraction& rest) const;
2013-06-19 16:25:29 +02:00
void append(Element*);
void appendTuplet(Tuplet* srcTuplet, Tuplet* dstTuplet);
2016-12-06 09:35:52 +01:00
void combineTuplet(Tuplet* dst, Tuplet* src);
2012-05-26 14:26:10 +02:00
public:
TrackList(ScoreRange* r) { _range = r; }
~TrackList();
2014-11-13 11:53:42 +01:00
Fraction ticks() 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; }
2014-11-13 11:53:42 +01:00
void read(const Segment* fs, const Segment* ls);
bool write(Score*, const Fraction&) const;
void appendGap(const Fraction&);
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 {
Fraction tick;
2013-06-19 16:25:29 +02:00
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();
2016-12-06 09:35:52 +01:00
void read(Segment* first, Segment* last, bool readSpanner = true);
bool write(Score*, const Fraction&) const;
Fraction ticks() const;
2012-05-26 14:26:10 +02:00
Segment* first() const { return _first; }
Segment* last() const { return _last; }
void fill(const Fraction&);
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