]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-score.cc
*** empty log message ***
[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 ()
25 {
26   layout_ = 0;
27   system_ = 0;
28 }
29
30 Paper_score::Paper_score (Paper_score const &s)
31   : Music_output (s)
32 {
33   assert (false);
34 }
35
36 void
37 Paper_score::typeset_line (System *system)
38 {
39   if (!system_)
40     system_ = system;
41
42   systems_ = scm_cons (system->self_scm (), systems_);
43   system->pscore_ = this;
44
45   scm_gc_unprotect_object (system->self_scm ());
46 }
47
48 Array<Column_x_positions>
49 Paper_score::calc_breaking ()
50 {
51   Break_algorithm *algorithm = 0;
52   Array<Column_x_positions> sol;
53
54   algorithm = new Gourlay_breaking;
55   algorithm->set_pscore (this);
56   sol = algorithm->solve ();
57   delete algorithm;
58
59   return sol;
60 }
61
62 SCM
63 Paper_score::process (String)
64 {
65   if (be_verbose_global)
66     message (_f ("Element count %d (spanners %d) ",
67                              system_->element_count (),
68                              system_->spanner_count ()));
69
70   message (_ ("Preprocessing graphical objects...") + " ");
71
72   /* FIXME: Check out why we need this - removing gives assertion failures
73      down the road.
74
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);
79
80   system_->pre_processing ();
81
82   Array<Column_x_positions> breaking = calc_breaking ();
83   system_->break_into_pieces (breaking);
84   SCM lines = system_->get_lines ();
85
86   /*
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.
90    */
91   return lines;
92 }