]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/p-score.hh
release: 0.0.63
[lilypond.git] / lily / include / p-score.hh
1 /*
2   p-score.hh -- declare PScore
3
4   source file of the LilyPond music typesetter
5
6   (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef P_SCORE_HH
11 #define P_SCORE_HH
12
13 #include "colhpos.hh"
14 #include "varray.hh"
15 #include "p-col.hh"
16 #include "p-staff.hh"
17
18
19 /** all stuff which goes onto paper. notes, signs, symbols in a score can be grouped in two ways:
20     horizontally (staffwise), and vertically (columns). #PScore#
21     contains the items, the columns and the staffs.
22  */
23
24 struct PScore {
25     Paper_def *paper_l_;
26     
27     /// the columns, ordered left to right
28     Pointer_list<PCol *> cols;
29
30     /// the idealspacings, no particular order
31     Pointer_list<Idealspacing*> suz;
32
33     /// the staffs ordered top to bottom
34     Pointer_list<PStaff*> staffs;
35
36     /// all symbols in score. No particular order.
37     Pointer_list<Item*> its;
38
39     /// if broken, the different lines
40     Pointer_list<Line_of_score*> lines;
41
42     /// crescs etc; no particular order
43     Pointer_list<Spanner *> spanners;
44
45     /// broken spanners
46     Pointer_list<Spanner*> broken_spans;
47
48     /* *************** */
49     /* CONSTRUCTION */
50     
51     PScore(Paper_def*);
52     /// add a line to the broken stuff. Positions given in #config#
53     void set_breaking(Array<Col_hpositions> const &);
54
55     void add(PStaff *);
56     
57
58     /** add an item.
59        add the item in specified containers. If breakstatus is set
60        properly, add it to the {pre,post}break of the pcol.
61        */
62     void typeset_item(Item *item_p,  PCol *pcol_l,PStaff*pstaf_l,int breakstatus=1);
63
64     /// add a Spanner
65     void typeset_spanner(Spanner*, PStaff*);
66  
67     ///    add to bottom of pcols
68     void add(PCol*);
69     void add_broken(Spanner*);
70
71     /* INSPECTION */
72     Array<Item*> select_items(PStaff*, PCol*);
73
74      /**
75        @return argument as a cursor of the list
76        */
77     PCursor<PCol *> find_col(PCol const *)const;
78
79     /* MAIN ROUTINES */
80     void process();
81
82     /// last deed of this struct
83     void output(Tex_stream &ts);
84
85     /* UTILITY ROUTINES */
86
87     /// get the spacing between c1 and c2, create one if necessary.
88     Idealspacing* get_spacing(PCol *c1, PCol *c2);
89
90     /// connect c1 and c2
91     void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
92
93     /// connect c1 and c2 and any children of c1 and c2
94     void connect(PCol* c1, PCol *c2, Real distance_f,Real  strength_f= 1.0);
95     
96     /* STANDARD ROUTINES */
97     void OK()const;
98     void print() const;
99 private:
100     /// before calc_breaking
101     void preprocess();
102
103     /// calculate where the lines are to be broken, and use results
104     void calc_breaking();
105
106     /// after calc_breaking
107     void postprocess();
108     
109     /// delete unused columns
110     void clean_cols();
111 };
112
113 #endif