MuseScore  3.4
Music composition and notation
range.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2012 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __DURATIONLIST_H__
14 #define __DURATIONLIST_H__
15 
16 #include "fraction.h"
17 
18 namespace Ms {
19 
20 class Element;
21 class Measure;
22 class Tuplet;
23 class Segment;
24 class Spanner;
25 class ScoreRange;
26 class ChordRest;
27 class Score;
28 
29 //---------------------------------------------------------
30 // TrackList
31 //---------------------------------------------------------
32 
33 class TrackList : public QList<Element*>
34  {
37  int _track;
38 
39  Tuplet* writeTuplet(Tuplet* parent, Tuplet* tuplet, Measure*& measure, Fraction& rest) const;
40  void append(Element*);
41  void appendTuplet(Tuplet* srcTuplet, Tuplet* dstTuplet);
42  void combineTuplet(Tuplet* dst, Tuplet* src);
43 
44  public:
45  TrackList(ScoreRange* r) { _range = r; }
46  ~TrackList();
47 
48  Fraction ticks() const { return _duration; }
49  ScoreRange* range() const { return _range; }
50 
51  int track() const { return _track; }
52  void setTrack(int val) { _track = val; }
53 
54  void read(const Segment* fs, const Segment* ls);
55  bool write(Score*, const Fraction&) const;
56 
57  void appendGap(const Fraction&);
58  bool truncate(const Fraction&);
59  void dump() const;
60  };
61 
62 //---------------------------------------------------------
63 // Annotation
64 //---------------------------------------------------------
65 
66 struct Annotation {
69  };
70 
71 //---------------------------------------------------------
72 // ScoreRange
73 //---------------------------------------------------------
74 
75 class ScoreRange {
76  QList<TrackList*> tracks;
79 
80  protected:
81  QList<Spanner*> spanner;
82  QList<Annotation> annotations;
83 
84  public:
86  ~ScoreRange();
87  void read(Segment* first, Segment* last, bool readSpanner = true);
88  bool write(Score*, const Fraction&) const;
89  Fraction ticks() const;
90  Segment* first() const { return _first; }
91  Segment* last() const { return _last; }
92  void fill(const Fraction&);
93  bool truncate(const Fraction&);
94 
95  friend class TrackList;
96  };
97 
98 
99 } // namespace Ms
100 #endif
101 
Fraction ticks() const
Definition: range.h:48
void append(Element *)
Definition: range.cpp:133
ScoreRange * range() const
Definition: range.h:49
ScoreRange()
Definition: range.h:85
void read(const Segment *fs, const Segment *ls)
Definition: range.cpp:261
one measure in a system
Definition: measure.h:65
Base class of score layout elements.
Definition: element.h:158
void combineTuplet(Tuplet *dst, Tuplet *src)
Definition: range.cpp:87
Segment * _last
Definition: range.h:78
~TrackList()
Definition: range.cpp:52
Definition: score.h:391
Element * e
Definition: range.h:68
Definition: range.h:66
Tuplet * writeTuplet(Tuplet *parent, Tuplet *tuplet, Measure *&measure, Fraction &rest) const
Definition: range.cpp:370
Example of 1/8 triplet: _baseLen = 1/8 _actualNotes = 3 _normalNotes = 2 (3 notes played in the time ...
Definition: tuplet.h:37
TrackList(ScoreRange *r)
Definition: range.h:45
QList< Annotation > annotations
Definition: range.h:82
bool write(Score *, const Fraction &) const
Definition: range.cpp:468
int track() const
Definition: range.h:51
ScoreRange * _range
Definition: range.h:36
Fraction _duration
Definition: range.h:35
Definition: segment.h:50
void appendGap(const Fraction &)
Definition: range.cpp:212
void appendTuplet(Tuplet *srcTuplet, Tuplet *dstTuplet)
Definition: range.cpp:70
Definition: aeolus.cpp:26
Fraction tick
Definition: range.h:67
Segment * first() const
Definition: range.h:90
void setTrack(int val)
Definition: range.h:52
Segment * _first
Definition: range.h:77
Definition: fraction.h:46
Definition: range.h:33
int _track
Definition: range.h:37
void dump() const
Definition: range.cpp:785
QList< TrackList * > tracks
Definition: range.h:76
Segment * last() const
Definition: range.h:91
bool truncate(const Fraction &)
Definition: range.cpp:237
Definition: range.h:75
QList< Spanner * > spanner
Definition: range.h:81