2005-04-18 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/paper-score-scheme.cc (LY_DEFINE): new file.
+ (LY_DEFINE): ly:paper-score-paper-systems: new function
+
+ * lily/score-scheme.cc (LY_DEFINE): require music argument.
+
* lily/score.cc (default_rendering): use Music_output too.
* input/test/chord-names-languages.ly (Module): rename file.
IMPLEMENT_SMOBS (Music_output);
IMPLEMENT_DEFAULT_EQUAL_P (Music_output);
-IMPLEMENT_TYPE_P (Music_output, "ly:score?");
+IMPLEMENT_TYPE_P (Music_output, "ly:music-output?");
SCM
Music_output::mark_smob (SCM s)
--- /dev/null
+/*
+ paper-score-scheme.cc -- implement Paper_score bindings
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "paper-score.hh"
+
+LY_DEFINE (ly_paper_score_paper_systems, "ly:paper-score-paper-systems",
+ 1, 0, 0,
+ (SCM paper_score),
+ "Return vector of Paper_system objects from @var{paper-score}.")
+{
+ Paper_score *pscore = dynamic_cast<Paper_score *> (unsmob_music_output (paper_score));
+ SCM_ASSERT_TYPE (pscore, paper_score, SCM_ARG1, __FUNCTION__, "Paper score (Music output)");
+
+ return pscore->get_paper_systems ();
+}
{
if (be_verbose_global)
message (_f ("Element count %d (spanners %d) ",
- system_->element_count (),
- system_->spanner_count ()));
+ system_->element_count (),
+ system_->spanner_count ()));
message (_ ("Preprocessing graphical objects...") + " ");
LY_DEFINE (ly_music_scorify, "ly:music-scorify",
2, 0, 0,
(SCM music, SCM parser),
- "Return MUSIC with TEXTS encapsulated in SCORE.")
+ "Return @var{music} with @var{texts} encapsulated in @var{score}.")
{
-#if 0
- SCM_ASSERT_TYPE (ly_c_music_p (music), music, SCM_ARG1, __FUNCTION__, "music");
-#endif
+ Music *mus = unsmob_music (music);
+ SCM_ASSERT_TYPE (mus, music, SCM_ARG1, __FUNCTION__, "music");
+
Score *score = new Score;
score->set_music (music, parser);
- scm_gc_unprotect_object (score->self_scm ());
- return score->self_scm ();
+
+ SCM self = score->self_scm ();
+ scm_gc_unprotect_object (self);
+ return self;
}
LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
score_def = sc->defs_[i];
if (!score_def)
- return scm_c_make_vector (0, SCM_EOL);
+ return SCM_BOOL_F;
score_def = score_def->clone ();
SCM prot = score_def->self_scm ();
SCM context = ly_run_translator (sc->get_music (), score_def->self_scm (),
key);
- SCM lines = ly_format_output (context);
+ SCM output = ly_format_output (context);
scm_remember_upto_here_1 (prot);
- return lines;
+ return output;
}
(def-markup-command (score layout props score) (ly:score?)
"Inline an image of music."
- (let* ((systems (ly:score-embedded-format score layout)))
+ (let* ((output (ly:score-embedded-format score layout)))
- (if (= (vector-length systems) 0)
+ (if (ly:music-output? output)
+ (ly:paper-system-stencil
+ (vector-ref (ly:paper-score-paper-systems output) 0))
(begin
(ly:warning (_"no systems found in \\score markup, does it have a \\layout block?"))
- empty-markup)
- (let* ((stencil (ly:paper-system-stencil (vector-ref systems 0))))
- (ly:stencil-aligned-to stencil Y CENTER)))))
+ empty-stencil))))
(def-markup-command (simple layout props str) (string?)
"A simple text string; @code{\\markup @{ foo @}} is equivalent with