]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/p-score.hh
3bf58582b5315f108d7ca2e2bb8c07f0a9e8dbb1
[lilypond.git] / lily / include / p-score.hh
1 /*
2   p-score.hh -- declare Paper_score
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.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 #include "music-output.hh"
18
19 /** all stuff which goes onto paper. notes, signs, symbols in a score
20      #Paper_score# contains the items, the columns.
21     
22     */
23
24 class Paper_score : public Music_output
25 {
26 public:
27   Paper_def *paper_l_;
28
29   /// the columns, ordered left to right
30   Link_list<Paper_column *> col_p_list_;
31
32   /// crescs etc; no particular order
33   Pointer_list<Spanner *> span_p_list_;
34
35   /// other elements
36   Pointer_list<Score_element*> elem_p_list_;
37   
38   Paper_outputter *outputter_l_;  
39   Line_of_score * line_l_;
40   
41   Paper_score ();
42     
43   virtual ~Paper_score();
44
45   String base_output_str () const;
46   virtual Paper_outputter* paper_outputter_p (Paper_stream*) const = 0;
47   virtual Paper_stream* paper_stream_p () const = 0;
48
49   /// add to bottom of pcols
50   void add_column (Paper_column*);
51
52   /**
53     @return argument as a cursor of the list
54     */
55   PCursor<Paper_column *> find_col (Paper_column const *) const;
56
57   Link_array<Paper_column> col_range (Paper_column *left_l, Paper_column *right_l) const;
58   Link_array<Paper_column> breakable_col_range (Paper_column*,Paper_column*) const;
59   Link_array<Item> broken_col_range (Item const*,Item const*) const;
60     
61     
62   /* STANDARD ROUTINES */
63   void print() const;
64   
65   void typeset_element (Score_element*);
66   void typeset_broken_spanner (Spanner*);
67   /// add a Spanner
68   void typeset_unbroken_spanner (Spanner*);
69  
70 protected:
71
72   
73     /* MAIN ROUTINES */
74   virtual void process();
75 // can't instantiate template with cygnus' gcc...
76 //  virtual ~Paper_score();
77
78 private:
79
80   void remove_line (Line_of_score*);
81   /// before calc_breaking
82   void preprocess();
83
84   void calc_idealspacing();
85   /// calculate where the lines are to be broken, and use results
86   Array<Column_x_positions> calc_breaking();
87
88   /// after calc_breaking
89   void postprocess();
90     
91   /// delete unused columns
92   void clean_cols();
93 };
94
95 #endif