2 paper-score.cc -- implement Paper_score
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "font-metric.hh"
13 #include "paper-def.hh"
15 #include "paper-column.hh"
16 #include "paper-score.hh"
17 #include "paper-column.hh"
18 #include "scm-hash.hh"
19 #include "gourlay-breaking.hh"
20 #include "paper-outputter.hh"
21 #include "file-results.hh"
23 #include "all-font-metrics.hh"
25 Paper_score::Paper_score ()
34 Paper_score::typeset_line (System *l)
40 main_smob_ = gh_cons (l->self_scm (), main_smob_);
44 We don't unprotect l->self_scm (), we haven't got any place else to
45 protect it from collection. */
49 Paper_score::Paper_score (Paper_score const &s)
55 Array<Column_x_positions>
56 Paper_score::calc_breaking ()
58 Break_algorithm *algorithm_p=0;
59 Array<Column_x_positions> sol;
61 algorithm_p = new Gourlay_breaking ;
62 algorithm_p->set_pscore (this);
63 sol = algorithm_p->solve ();
73 Paper_score::process ()
76 progress_indication (_f ("Element count %d ", line_l_->element_count ()));
79 progress_indication (_ ("Preprocessing elements...") + " ");
82 Be sure to set breakability on first & last column.
84 Link_array<Grob> pc (line_l_->column_l_arr ());
86 pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
87 pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
89 line_l_->pre_processing ();
91 Array<Column_x_positions> breaking = calc_breaking ();
92 line_l_->break_into_pieces (breaking);
94 outputter_l_ = paper_l_->paper_outputter_p ();
96 outputter_l_->output_header ();
97 outputter_l_->output_version ();
99 progress_indication ("\n");
104 outputter_l_->output_scope (global_header_p, "lilypond");
105 outputter_l_->write_header_fields_to_file (global_header_p);
109 outputter_l_->output_scope (header_l_, "lilypond");
110 outputter_l_->write_header_fields_to_file (header_l_);
113 outputter_l_->output_comment (_ ("Outputting Score, defined at: "));
114 outputter_l_->output_comment (origin_str_);
116 if (paper_l_->variable_tab_)
117 outputter_l_->output_scope (paper_l_->variable_tab_, "lilypondpaper");
119 SCM scm = scm_list_n (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
120 outputter_l_->output_scheme (scm);
122 line_l_->output_lines ();
124 scm = scm_list_n (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
125 outputter_l_->output_scheme (scm);
127 progress_indication ("\n");
133 if (verbose_global_b)
134 ly_display_scm (scm_gc_stats ());