]> git.donarmstrong.com Git - lilypond.git/blob - hdr/pscore.hh
release: 0.0.27
[lilypond.git] / hdr / pscore.hh
1 // the breaking problem for a score.
2
3 #ifndef PSCORE_HH
4 #define PSCORE_HH
5
6 #include "break.hh"
7 #include "varray.hh"
8 #include "pcol.hh"
9 #include "pstaff.hh"
10
11 /// all stuff which goes onto paper
12 struct PScore {
13     Paperdef *paper_l_;
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     /* CONSTRUCTION */
38     
39     PScore(Paperdef*);
40     /// add a line to the broken stuff. Positions given in #config#
41     void set_breaking(Array<Col_configuration>);
42
43     void add(PStaff *);
44     
45     /// add item
46     void typeset_item(Item *,  PCol *,PStaff*,int=1);
47
48     /// add a Spanner
49     void typeset_spanner(Spanner*, PStaff*);
50  
51     ///    add to bottom of pcols
52     void add(PCol*);
53     void add_broken(Spanner*);
54
55     /* INSPECTION */
56     Array<Item*> select_items(PStaff*, PCol*);
57
58     /// return argument as a cursor.
59     PCursor<PCol *> find_col(const PCol *)const;
60
61     /* MAIN ROUTINES */
62     void process();
63
64     /// last deed of this struct
65     void output(Tex_stream &ts);
66
67     /* UTILITY ROUTINES */
68
69     /// get the spacing between c1 and c2, create one if necessary.
70     Idealspacing* get_spacing(PCol *c1, PCol *c2);
71
72     /// connect c1 and c2
73     void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
74
75     /// connect c1 and c2 and any children of c1 and c2
76     void connect(PCol* c1, PCol *c2, Real distance_f,Real  strength_f= 1.0);
77     
78     /* STANDARD ROUTINES */
79     void OK()const;
80     void print() const;
81 private:
82     /// before calc_breaking
83     void preprocess();
84
85     /// calculate where the lines are to be broken, and use results
86     void calc_breaking();
87
88     /// after calc_breaking
89     void postprocess();
90     
91     /// delete unused columns
92     void clean_cols();
93 };
94 /** notes, signs, symbols in a score can be grouped in two ways:
95     horizontally (staffwise), and vertically (columns). #PScore#
96     contains the items, the columns and the staffs.
97  */
98 #endif