]> git.donarmstrong.com Git - lilypond.git/blob - hdr/pscore.hh
release: 0.0.18
[lilypond.git] / hdr / pscore.hh
1 // the breaking problem for a score.
2
3 #ifndef PSCORE_HH
4 #define PSCORE_HH
5
6
7 #include "vray.hh"
8 #include "pcol.hh"
9 #include "pstaff.hh"
10
11 /// all stuff which goes onto paper
12 struct PScore {
13     Paperdef *paper_;           // indirection.
14     
15     /// the columns, ordered left to right
16     IPointerList<PCol *> cols;
17
18     /// the idealspacings, no particular order
19     IPointerList<Idealspacing*> suz;
20
21     /// the staffs ordered top to bottom
22     IPointerList<PStaff*> staffs;
23
24     /// all symbols in score. No particular order.
25     IPointerList<Item*> its;
26
27     /// if broken, the different lines
28     IPointerList<Line_of_score*> lines;
29
30     /// crescs etc; no particular order
31     IPointerList<Spanner *> spanners;
32
33     /// broken spanners
34     IPointerList<Spanner*> broken_spans;
35
36     /****************/
37
38     void add_broken(Spanner*);
39     
40     svec<Item*> select_items(PStaff*, PCol*);
41
42     /// before calc_breaking
43     void preprocess();
44     
45     void calc_breaking();
46     /**
47       calculate where the lines are to be broken.
48
49       POST
50     
51       lines contain the broken lines.
52      */
53
54     /// after calc_breaking
55     void postprocess();
56     
57     /// search all pcols which are breakable.
58     svec< PCol *> find_breaks() const;
59
60     /// add a line to the broken stuff. Positions given in #config#
61     void add_line(svec< PCol *> curline, svec<Real> config);
62
63     /// helper: solve for the columns in #curline#.
64     svec<Real> solve_line(svec<PCol *> curline) const;
65
66     void add(PStaff *);
67     /// add item
68     void typeset_item(Item *,  PCol *,PStaff*,int=1);
69
70     /// add an Spanner
71     void typeset_spanner(Spanner*, PStaff*);
72  
73     ///    add to bottom of pcols
74     void add(PCol*);
75     /**
76
77     */
78     void output(Tex_stream &ts);
79
80     Idealspacing* get_spacing(PCol *, PCol *);
81     /*
82     get the spacing between c1 and c2, create one if necessary.
83     */
84
85     /// return argument as a cursor.
86     PCursor<PCol *> find_col(PCol *)const;
87
88     /// delete unused columns
89     void clean_cols();
90
91
92     /// check if the spacing/breaking problem is well-stated
93     void problem_OK() const;
94
95     /// invarinants
96     void OK()const;
97     PScore(Paperdef*);
98     void print() const;
99
100     /// does curline fit on the paper?
101     bool feasible(svec<PCol *> curline) const;
102
103     /// which is first (left, higher)
104     int compare_pcols( PCol*, PCol*)const;
105 };
106 /** notes, signs, symbols in a score can be grouped in two ways:
107     horizontally (staffwise), and vertically (columns). #PScore#
108     contains the items, the columns and the staffs.
109  */
110 #endif