lilypond-0.0.40
[lilypond.git] / hdr / pscore.hh
blobb7ad49c0e12ea69eea8cd7d59386768010675196
1 // the breaking problem for a score.
3 #ifndef PSCORE_HH
4 #define PSCORE_HH
6 #include "colhpos.hh"
7 #include "varray.hh"
8 #include "pcol.hh"
9 #include "pstaff.hh"
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.
17 struct PScore {
18 Paper_def *paper_l_;
20 /// the columns, ordered left to right
21 IPointerList<PCol *> cols;
23 /// the idealspacings, no particular order
24 IPointerList<Idealspacing*> suz;
26 /// the staffs ordered top to bottom
27 IPointerList<PStaff*> staffs;
29 /// all symbols in score. No particular order.
30 IPointerList<Item*> its;
32 /// if broken, the different lines
33 IPointerList<Line_of_score*> lines;
35 /// crescs etc; no particular order
36 IPointerList<Spanner *> spanners;
38 /// broken spanners
39 IPointerList<Spanner*> broken_spans;
41 /* *************** */
42 /* CONSTRUCTION */
44 PScore(Paper_def*);
45 /// add a line to the broken stuff. Positions given in #config#
46 void set_breaking(Array<Col_hpositions>);
48 void add(PStaff *);
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.
55 void typeset_item(Item *item_p, PCol *pcol_l,PStaff*pstaf_l,int breakstatus=1);
57 /// add a Spanner
58 void typeset_spanner(Spanner*, PStaff*);
60 /// add to bottom of pcols
61 void add(PCol*);
62 void add_broken(Spanner*);
64 /* INSPECTION */
65 Array<Item*> select_items(PStaff*, PCol*);
67 /**
68 @return argument as a cursor of the list
70 PCursor<PCol *> find_col(const PCol *)const;
72 /* MAIN ROUTINES */
73 void process();
75 /// last deed of this struct
76 void output(Tex_stream &ts);
78 /* UTILITY ROUTINES */
80 /// get the spacing between c1 and c2, create one if necessary.
81 Idealspacing* get_spacing(PCol *c1, PCol *c2);
83 /// connect c1 and c2
84 void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
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);
89 /* STANDARD ROUTINES */
90 void OK()const;
91 void print() const;
92 private:
93 /// before calc_breaking
94 void preprocess();
96 /// calculate where the lines are to be broken, and use results
97 void calc_breaking();
99 /// after calc_breaking
100 void postprocess();
102 /// delete unused columns
103 void clean_cols();
106 #endif