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>
12 #include "font-metric.hh"
14 #include "paper-def.hh"
16 #include "paper-column.hh"
17 #include "paper-score.hh"
18 #include "paper-column.hh"
19 #include "scm-hash.hh"
20 #include "gourlay-breaking.hh"
21 #include "paper-outputter.hh"
22 #include "file-results.hh"
24 #include "all-font-metrics.hh"
26 Paper_score::Paper_score ()
35 Paper_score::typeset_line (System *l)
41 main_smob_ = gh_cons (l->self_scm (), main_smob_);
45 We don't unprotect l->self_scm (), we haven't got any place else to
46 protect it from collection. */
50 Paper_score::Paper_score (Paper_score const &s)
56 Array<Column_x_positions>
57 Paper_score::calc_breaking ()
59 Break_algorithm *algorithm=0;
60 Array<Column_x_positions> sol;
62 algorithm = new Gourlay_breaking ;
63 algorithm->set_pscore (this);
64 sol = algorithm->solve ();
74 Paper_score::process ()
77 progress_indication (_f ("Element count %d ", system_->element_count ()));
80 progress_indication (_ ("Preprocessing elements...") + " ");
83 Be sure to set breakability on first & last column.
85 Link_array<Grob> pc (system_->columns ());
87 pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
88 pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
90 system_->pre_processing ();
92 Array<Column_x_positions> breaking = calc_breaking ();
93 system_->break_into_pieces (breaking);
95 outputter_ = paper_->get_paper_outputter ();
96 outputter_->output_header ();
97 outputter_->output_version ();
99 progress_indication ("\n");
101 if (global_input_file->global_header_)
103 outputter_->output_scope (global_input_file->global_header_, "lilypond");
104 outputter_->write_header_fields_to_file (global_input_file->global_header_);
109 outputter_->output_scope (header_, "lilypond");
110 outputter_->write_header_fields_to_file (header_);
113 outputter_->output_comment (_ ("Outputting Score, defined at: "));
114 outputter_->output_comment (origin_string_);
116 if (paper_->variable_tab_)
117 outputter_->output_scope (paper_->variable_tab_, "lilypondpaper");
119 SCM scm = scm_list_n (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
120 outputter_->output_scheme (scm);
122 system_->output_lines ();
124 scm = scm_list_n (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
125 outputter_->output_scheme (scm);
127 progress_indication ("\n");
133 if (verbose_global_b)
135 scm_write (scm_gc_stats (), scm_current_error_port ());
136 scm_flush (scm_current_error_port ());