X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscore.cc;h=ee628b9b25f91863056b6726c67bb7d80ea98145;hb=16daefb5104997473ab77fd00faf00f34c6baa7e;hp=f3cca4d3340a069fd020e17997bb64369bceaafb;hpb=bdf4ab13203502e7ec7cf9cf5896527643a07c1f;p=lilypond.git diff --git a/lily/score.cc b/lily/score.cc index f3cca4d334..ee628b9b25 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -116,41 +116,37 @@ default_rendering (SCM music, SCM outdef, } SCM context = ly_run_translator (music, scaled_def, key); - if (Global_context *g = dynamic_cast - (unsmob_context (context))) + Music_output *output = unsmob_music_output (ly_format_output (context)); + + if (Paper_score *pscore = dynamic_cast (output)) { - SCM systems = ly_format_output (context, outname); - Music_output *output = g->get_output (); - if (systems != SCM_UNDEFINED) - { - /* ugh, this is strange, Paper_book without a Book object. */ - Paper_book *paper_book = new Paper_book (); - paper_book->header_ = header; - paper_book->paper_ = unsmob_output_def (scaled_bookdef); + /* ugh, this is strange, Paper_book without a Book object. */ + Paper_book *paper_book = new Paper_book (); + paper_book->header_ = header; + paper_book->paper_ = unsmob_output_def (scaled_bookdef); - if (ly_c_module_p (header)) - paper_book->add_score (header); - paper_book->add_score (systems); + if (ly_c_module_p (header)) + paper_book->add_score (header); - paper_book->classic_output (ly_scm2string (outname)); - scm_gc_unprotect_object (paper_book->self_scm ()); - } - delete output; + SCM systems = pscore->get_paper_systems (); + paper_book->add_score (systems); + + paper_book->classic_output (ly_scm2string (outname)); + scm_gc_unprotect_object (paper_book->self_scm ()); } + scm_gc_unprotect_object (output->self_scm ()); scm_remember_upto_here_1 (scaled_def); scm_remember_upto_here_1 (scaled_bookdef); } /* - Format score, return systems. OUTNAME is still passed to create a midi - file. + Format score, return list of Music_output objects. LAYOUTBOOK should be scaled already. */ SCM -Score::book_rendering (String outname, - Output_def *layoutbook, +Score::book_rendering (Output_def *layoutbook, Output_def *default_def, Object_key *book_key) { @@ -163,8 +159,9 @@ Score::book_rendering (String outname, if (layoutbook && layoutbook->c_variable ("is-paper") == SCM_BOOL_T) scale = scm_to_double (layoutbook->c_variable ("outputscale")); - SCM out = scm_makfrom0str (outname.to_str0 ()); - SCM systems = SCM_EOL; + SCM outputs = SCM_EOL; + SCM *tail = &outputs; + int outdef_count = defs_.size (); Object_key *key = new Lilypond_general_key (book_key, user_key_, 0); @@ -175,6 +172,7 @@ Score::book_rendering (String outname, { Output_def *def = outdef_count ? defs_[i] : default_def; SCM scaled = SCM_EOL; + if (def->c_variable ("is-layout") == SCM_BOOL_T) { def = scale_output_def (def, scale); @@ -187,9 +185,10 @@ Score::book_rendering (String outname, SCM context = ly_run_translator (music_, def->self_scm (), scm_key); if (dynamic_cast (unsmob_context (context))) { - SCM s = ly_format_output (context, out); - if (s != SCM_UNDEFINED) - systems = s; + SCM s = ly_format_output (context); + + *tail = scm_cons (s, SCM_EOL); + tail = SCM_CDRLOC(*tail); } scm_remember_upto_here_1 (scaled); @@ -197,7 +196,7 @@ Score::book_rendering (String outname, scm_remember_upto_here_1 (scm_key); scm_remember_upto_here_1 (scaled_bookdef); - return systems; + return outputs; } void @@ -210,13 +209,13 @@ Score::set_music (SCM music, SCM parser) if (unsmob_music (music_)) { - unsmob_music (music)->origin ()->error (_ ("Already have music in score")); - unsmob_music (music_)->origin ()->error (_ ("This is the previous music")); + unsmob_music (music)->origin ()->error (_ ("already have music in score")); + unsmob_music (music_)->origin ()->error (_ ("this is the previous music")); } Music *m = unsmob_music (music); if (m && to_boolean (m->get_property ("error-found"))) { - m->origin ()->error (_ ("Error found in this music expression. Ignoring it")); + m->origin ()->error (_ ("errors found, ignoring music expression")); this->error_found_ = this->error_found_ || to_boolean (m->get_property ("error-found")); }