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