1 
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3 
4 /*
5     Rosegarden
6     A MIDI and audio sequencer and musical notation editor.
7     Copyright 2000-2021 the Rosegarden development team.
8 
9     Other copyrights also apply to some parts of this work.  Please
10     see the AUTHORS file and individual file headers for details.
11 
12     This program is free software; you can redistribute it and/or
13     modify it under the terms of the GNU General Public License as
14     published by the Free Software Foundation; either version 2 of the
15     License, or (at your option) any later version.  See the file
16     COPYING included with this distribution for more information.
17 */
18 
19 #ifndef RG_NOTATIONVLAYOUT_H
20 #define RG_NOTATIONVLAYOUT_H
21 
22 #include "base/LayoutEngine.h"
23 #include <map>
24 #include <vector>
25 #include "base/Event.h"
26 
27 #include "NotationElement.h"
28 
29 
30 class SlurList;
31 class QObject;
32 
33 
34 namespace Rosegarden
35 {
36 
37 class ViewSegment;
38 class Quantizer;
39 class Composition;
40 class NotePixmapFactory;
41 class NotationStaff;
42 class NotationProperties;
43 class Composition;
44 
45 
46 /// Vertical notation layout
47 /**
48  * computes the Y coordinate of notation elements
49  */
50 class NotationVLayout : public VerticalLayoutEngine,
51                         public QObject  // For tr().  Can probably be cleaned up.
52 {
53     //Q_OBJECT
54 public:
55     NotationVLayout(Composition *c, NotePixmapFactory *npf,
56                     const NotationProperties &properties,
57                     QObject* parent);
58 
59     ~NotationVLayout() override;
60 
setNotePixmapFactory(NotePixmapFactory * npf)61     void setNotePixmapFactory(NotePixmapFactory *npf) {
62         m_npf = npf;
63     }
64 
65     /**
66      * Resets internal data stores for all staffs
67      */
68     void reset() override;
69 
70     /**
71      * Lay out a single staff.
72      */
73     void scanViewSegment(ViewSegment &,
74 				 timeT startTime,
75 				 timeT endTime,
76 				 bool full) override;
77 
78     /**
79      * Do any layout dependent on more than one staff.  As it
80      * happens, we have none, but we do have some layout that
81      * depends on the final results from the horizontal layout
82      * (for slurs), so we should do that here
83      */
84     void finishLayout(timeT startTime,
85                               timeT endTime,
86 			      bool full) override;
87 
88 private:
89     void positionSlur(NotationStaff &staff, NotationElementList::iterator i);
90 
91     typedef std::vector<NotationElementList::iterator> SlurList;
92     typedef std::map<ViewSegment *, SlurList> SlurListMap;
93 
94     //--------------- Data members ---------------------------------
95 
96     SlurListMap m_slurs;
97     SlurList &getSlurList(ViewSegment &);
98 
99     Composition *m_composition;
100     NotePixmapFactory *m_npf;
101     const Quantizer *m_notationQuantizer;
102     const NotationProperties &m_properties;
103 
104     bool m_showRepeated;
105     bool m_distributeVerses;
106 };
107 
108 
109 }
110 
111 #endif
112