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