]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/p-score.hh
32231f6371415397c2f99f3d1573d7aea854a620
[lilypond.git] / lily / include / p-score.hh
1 /*
2   p-score.hh -- declare PScore
3
4   source file of the GNU 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 "parray.hh"
15 #include "lily-proto.hh"
16 #include "plist.hh"
17
18 /** all stuff which goes onto paper. notes, signs, symbols in a score
19      #PScore# contains the items, the columns.
20     
21     */
22
23 class PScore {
24 public:
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     /// crescs etc; no particular order
34     Pointer_list<Spanner *> spanners;
35
36     /// other elements
37     Pointer_list<Score_elem*> elem_p_list_;
38     
39     Super_elem *super_elem_l_;
40
41     /* *************** */
42     /* CONSTRUCTION */
43     
44     PScore(Paper_def*);
45     /// add a line to the broken stuff. Positions given in #config#
46     void set_breaking(Array<Col_hpositions> const &);
47
48     /** add an item.
49        add the item in specified containers. If breakstatus is set
50        properly, add it to the {pre,post}break of the pcol.
51        */
52     void typeset_item(Item *item_p,  PCol *pcol_l,int breakstatus=0);
53
54     ///    add to bottom of pcols
55     void add(PCol*);
56
57     /**
58       @return argument as a cursor of the list
59       */
60     PCursor<PCol *> find_col(PCol const *)const;
61
62     Link_array<PCol> col_range(PCol *left_l, PCol *right_l) const;
63     Link_array<PCol> breakable_col_range(PCol*,PCol*) const;
64     Link_array<PCol> broken_col_range(PCol*,PCol*) const;
65     
66     /* MAIN ROUTINES */
67     void process();
68
69     /// last deed of this struct
70     void output(Tex_stream &ts);
71
72     /* UTILITY ROUTINES */
73
74     /// get the spacing between c1 and c2, create one if necessary.
75     Idealspacing* get_spacing(PCol *c1, PCol *c2);
76
77     /// connect c1 and c2
78     void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
79
80     /// connect c1 and c2 and any children of c1 and c2
81     void connect(PCol* c1, PCol *c2, Real distance_f,Real  strength_f= 1.0);
82     
83     /* STANDARD ROUTINES */
84     void OK()const;
85     void print() const;
86     ~PScore();
87     void typeset_element(Score_elem*);
88     void typeset_broken_spanner(Spanner*);
89     /// add a Spanner
90     void typeset_unbroken_spanner(Spanner*);
91  
92     
93 private:
94     /// before calc_breaking
95     void preprocess();
96
97     /// calculate where the lines are to be broken, and use results
98     void calc_breaking();
99
100     /// after calc_breaking
101     void postprocess();
102     
103     /// delete unused columns
104     void clean_cols();
105 };
106
107 #endif