]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-score.cc
* lily/include/paper-score.hh (class Paper_score): remove unused prototypes.
[lilypond.git] / lily / paper-score.cc
1 /*
2   paper-score.cc -- implement Paper_score
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "paper-score.hh"
10
11 #include "all-font-metrics.hh"
12 #include "gourlay-breaking.hh"
13 #include "main.hh"
14 #include "misc.hh"
15 #include "output-def.hh"
16 #include "paper-book.hh"
17 #include "paper-column.hh"
18 #include "scm-hash.hh"
19 #include "score.hh"
20 #include "stencil.hh"
21 #include "system.hh"
22 #include "warn.hh"
23
24 Paper_score::Paper_score (Output_def *layout)
25 {
26   layout_ = layout;
27   system_ = 0;
28   systems_ = SCM_EOL;
29 }
30
31 Paper_score::Paper_score (Paper_score const &s)
32   : Music_output (s)
33 {
34   assert (false);
35 }
36
37
38 void
39 Paper_score::derived_mark () const
40 {
41   scm_gc_mark (systems_);
42 }
43
44 void
45 Paper_score::typeset_system (System *system)
46 {
47   if (!system_)
48     system_ = system;
49
50   systems_ = scm_cons (system->self_scm (), systems_);
51   system->pscore_ = this;
52
53   scm_gc_unprotect_object (system->self_scm ());
54 }
55
56 Array<Column_x_positions>
57 Paper_score::calc_breaking ()
58 {
59   Break_algorithm *algorithm = 0;
60   Array<Column_x_positions> sol;
61
62   algorithm = new Gourlay_breaking;
63   algorithm->set_pscore (this);
64   sol = algorithm->solve ();
65   delete algorithm;
66
67   return sol;
68 }
69
70 void
71 Paper_score::process ()
72 {
73   if (be_verbose_global)
74     message (_f ("Element count %d (spanners %d) ",
75                              system_->element_count (),
76                              system_->spanner_count ()));
77
78   message (_ ("Preprocessing graphical objects...") + " ");
79
80   /* FIXME: Check out why we need this - removing gives assertion failures
81      down the road.
82
83      doubly, also done in Score_engraver */
84   Link_array<Grob> pc (system_->columns ());
85   pc[0]->set_property ("breakable", SCM_BOOL_T);
86   pc.top ()->set_property ("breakable", SCM_BOOL_T);
87
88   system_->pre_processing ();
89
90   Array<Column_x_positions> breaking = calc_breaking ();
91   system_->break_into_pieces (breaking);
92   system_->get_paper_systems ();
93 }
94
95 System *
96 Paper_score::root_system () const
97 {
98   return system_;
99 }
100
101 Output_def *
102 Paper_score::layout () const
103 {
104   return layout_;
105 }
106   
107
108 SCM
109 Paper_score::get_systems () const
110 {
111   return root_system ()->get_paper_systems ();
112 }