2 p-score.cc -- implement Paper_score
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "paper-def.hh"
14 #include "line-of-score.hh"
15 #include "paper-column.hh"
16 #include "paper-score.hh"
17 #include "paper-column.hh"
19 #include "gourlay-breaking.hh"
20 #include "paper-stream.hh"
21 #include "paper-outputter.hh"
22 #include "file-results.hh"
24 #include "all-font-metrics.hh"
26 Paper_score::Paper_score ()
30 line_l_ = new Line_of_score;
31 element_smob_list_ = SCM_EOL;
32 typeset_line (line_l_);
36 Paper_score::typeset_line (Line_of_score *l)
38 line_l_->pscore_l_ = this;
39 element_smob_list_ = gh_cons (l->self_scm_, element_smob_list_);
42 Paper_score::Paper_score (Paper_score const &s)
48 Array<Column_x_positions>
49 Paper_score::calc_breaking ()
51 Break_algorithm *algorithm_p=0;
52 Array<Column_x_positions> sol;
54 algorithm_p = new Gourlay_breaking ;
55 algorithm_p->set_pscore (this);
56 sol = algorithm_p->solve ();
68 Paper_score::process ()
70 progress_indication (_ ("Preprocessing elements...") + " ");
73 Be sure to set breakability on first & last column.
75 Link_array<Paper_column> pc (line_l_->column_l_arr ());
77 pc[0]->set_elt_property ("breakable", SCM_BOOL_T);
78 pc.top ()->set_elt_property ("breakable", SCM_BOOL_T);
80 line_l_->pre_processing ();
82 Array<Column_x_positions> breaking = calc_breaking ();
83 line_l_->break_into_pieces (breaking);
85 SCM lines = line_l_->output_lines ();
87 outputter_l_ = new Paper_outputter ;
88 outputter_l_->output_header ();
89 outputter_l_->output_version();
92 outputter_l_->output_scope (header_global_p, "mudela");
94 outputter_l_->output_scope (header_l_, "mudela");
96 outputter_l_->output_comment (_ ("Outputting Score, defined at: "));
97 outputter_l_->output_comment (origin_str_);
99 if (paper_l_->scope_p_)
100 outputter_l_->output_scope (paper_l_->scope_p_, "mudelapaper");
103 if(experimental_features_global_b)
105 SCM scm = gh_list (ly_symbol2scm ("experimental-on"), SCM_UNDEFINED);
106 outputter_l_->output_scheme (scm);
108 scm = gh_list (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
109 outputter_l_->output_scheme (scm);
111 SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ());
112 outputter_l_->output_scheme (gh_list (ly_symbol2scm ("define-fonts"),
116 for (SCM i = lines ; gh_pair_p (i); i = gh_cdr (i))
117 for (SCM j = gh_car (i) ; gh_pair_p (j); j = gh_cdr (j))
118 outputter_l_->output_scheme (gh_car (j));
120 scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
121 outputter_l_->output_scheme (scm);
124 Paper_stream* psp = paper_l_->paper_stream_p ();
125 outputter_l_->dump_onto (psp);