]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/paper-score-scheme.cc (LY_DEFINE): new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Apr 2005 13:27:48 +0000 (13:27 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Apr 2005 13:27:48 +0000 (13:27 +0000)
(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.

* lily/paper-score.cc (process): run get_paper_systems() only once.

ChangeLog
lily/music-output.cc
lily/paper-score-scheme.cc [new file with mode: 0644]
lily/paper-score.cc
lily/score-scheme.cc
scm/define-markup-commands.scm

index 43bd3a5a3c2d5a189a03148960b358d84eca1a8d..d9816a68ca0f4e2661e020bfb3e4d56ec92cbfac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 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.
index 958a78a8874f2ef9f65b32ce24cc6917d5171c7b..5330e864eb3bdf93924d07df564bc50f413a6a12 100644 (file)
@@ -32,7 +32,7 @@ Music_output::derived_mark () const
 
 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)
diff --git a/lily/paper-score-scheme.cc b/lily/paper-score-scheme.cc
new file mode 100644 (file)
index 0000000..031c76b
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+  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 ();
+}
index 2c1f0797d0f86c59ce746fc046f3bc61a27a97fd..b7568416793f3dbc0b3e7c06858aef087d9bb233 100644 (file)
@@ -74,8 +74,8 @@ Paper_score::process ()
 {
   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...") + " ");
 
index 56a175149e17b52d75fd3d5b8bb1fc41e176f075..fce8296dc9a9111277691d5df5d55a2a2f4711bb 100644 (file)
 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",
@@ -50,7 +52,7 @@ 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 ();
@@ -62,8 +64,8 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
 
   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;
 }
index 33cb29a993e169f22cf0cba1784e05ba29226e37..8c0d58cb62cdc1d3a3d232085505933daf93f087 100644 (file)
@@ -103,14 +103,14 @@ one staff-space."
 
 (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