X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fscore-scheme.cc;h=1d3e55bc6e31873047eae282ac033a6fe865fcf5;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=7a306af442703f7faf35683c048d5863a1605363;hpb=08560a1b8076630c4fc6cb9b902614d8b74fd6fc;p=lilypond.git diff --git a/lily/score-scheme.cc b/lily/score-scheme.cc index 7a306af442..1d3e55bc6e 100644 --- a/lily/score-scheme.cc +++ b/lily/score-scheme.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2005--2012 Han-Wen Nienhuys + Copyright (C) 2005--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ LY_DEFINE (ly_score_output_defs, "ly:score-output-defs", "All output definitions in a score.") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = unsmob_score (score); + Score *sc = unsmob (score); SCM l = SCM_EOL; for (vsize i = 0; i < sc->defs_.size (); i++) @@ -58,8 +58,8 @@ LY_DEFINE (ly_score_add_output_def_x, "ly:score-add-output-def!", { LY_ASSERT_SMOB (Score, score, 1); LY_ASSERT_SMOB (Output_def, def, 2); - Score *sc = unsmob_score (score); - Output_def *output_def = unsmob_output_def (def); + Score *sc = unsmob (score); + Output_def *output_def = unsmob (def); sc->add_output_def (output_def); return SCM_UNSPECIFIED; } @@ -69,7 +69,7 @@ LY_DEFINE (ly_score_header, "ly:score-header", "Return score header.") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = unsmob_score (score); + Score *sc = unsmob (score); return sc->get_header (); } @@ -81,7 +81,7 @@ LY_DEFINE (ly_score_set_header_x, "ly:score-set-header!", SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__, "module"); - Score *sc = unsmob_score (score); + Score *sc = unsmob (score); sc->set_header (module); return SCM_UNSPECIFIED; } @@ -91,7 +91,7 @@ LY_DEFINE (ly_score_music, "ly:score-music", "Return score music.") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = unsmob_score (score); + Score *sc = unsmob (score); return sc->get_music (); } @@ -100,7 +100,7 @@ LY_DEFINE (ly_score_error_p, "ly:score-error?", "Was there an error in the score?") { LY_ASSERT_SMOB (Score, score, 1); - Score *sc = unsmob_score (score); + Score *sc = unsmob (score); return scm_from_bool (sc->error_found_); } @@ -113,8 +113,8 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", LY_ASSERT_SMOB (Score, score, 1); LY_ASSERT_SMOB (Output_def, layout, 2); - Score *sc = unsmob_score (score); - Output_def *od = unsmob_output_def (layout); + Score *sc = unsmob (score); + Output_def *od = unsmob (layout); if (sc->error_found_) return SCM_EOL; @@ -124,22 +124,22 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", /* UGR, FIXME, these are default \layout blocks once again. They suck. */ for (vsize i = 0; !score_def && i < sc->defs_.size (); i++) - if (sc->defs_[i]->c_variable ("is-layout") == SCM_BOOL_T) + if (to_boolean (sc->defs_[i]->c_variable ("is-layout"))) score_def = sc->defs_[i]; if (!score_def) return SCM_BOOL_F; - score_def = score_def->clone (); - SCM prot = score_def->unprotect (); + /* Don't rescale if the layout has already been scaled */ + if (to_boolean (score_def->c_variable ("cloned"))) + score_def = score_def->clone (); + else + score_def = scale_output_def (score_def, output_scale (od)); - /* TODO: SCORE_DEF should be scaled according to OD->parent_ or OD - itself. */ score_def->parent_ = od; - SCM context = ly_run_translator (sc->get_music (), score_def->self_scm ()); + SCM context = ly_run_translator (sc->get_music (), score_def->unprotect ()); SCM output = ly_format_output (context); - scm_remember_upto_here_1 (prot); return output; }