*** empty log message ***
[lilypond/patrick.git] / lily / paper-score.cc
blob800aa132ed77023f08d0388d5e9c4c7933de4124
1 /*
2 paper-score.cc -- implement Paper_score
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "paper-score.hh"
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"
24 Paper_score::Paper_score ()
26 layout_ = 0;
27 system_ = 0;
30 Paper_score::Paper_score (Paper_score const &s)
31 : Music_output (s)
33 assert (false);
36 void
37 Paper_score::typeset_line (System *system)
39 if (!system_)
40 system_ = system;
42 systems_ = scm_cons (system->self_scm (), systems_);
43 system->pscore_ = this;
45 scm_gc_unprotect_object (system->self_scm ());
48 Array<Column_x_positions>
49 Paper_score::calc_breaking ()
51 Break_algorithm *algorithm = 0;
52 Array<Column_x_positions> sol;
54 algorithm = new Gourlay_breaking;
55 algorithm->set_pscore (this);
56 sol = algorithm->solve ();
57 delete algorithm;
59 return sol;
62 SCM
63 Paper_score::process (String)
65 if (be_verbose_global)
66 message (_f ("Element count %d (spanners %d) ",
67 system_->element_count (),
68 system_->spanner_count ()));
70 message (_ ("Preprocessing graphical objects...") + " ");
72 /* FIXME: Check out why we need this - removing gives assertion failures
73 down the road.
75 doubly, also done in Score_engraver */
76 Link_array<Grob> pc (system_->columns ());
77 pc[0]->set_property ("breakable", SCM_BOOL_T);
78 pc.top ()->set_property ("breakable", SCM_BOOL_T);
80 system_->pre_processing ();
82 Array<Column_x_positions> breaking = calc_breaking ();
83 system_->break_into_pieces (breaking);
84 SCM lines = system_->get_lines ();
87 retain Grobs, since they are pointed to by the point & click data
88 structures, and are not marked fully, because child -> parent
89 links aren't marked.
91 return lines;