]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-book.cc
First round of tutorial updates.
[lilypond.git] / lily / paper-book.cc
index d41feabbf42b29de174d3918444b29d2d10a76a6..89e8b8ded33c3eaad7f28c8de1de17c5c345c1db 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2004--2006 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 2004--2007 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "paper-book.hh"
@@ -11,6 +11,7 @@
 #include "grob.hh"
 #include "main.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "paper-score.hh"
 #include "paper-system.hh"
 #include "text-interface.hh"
@@ -90,9 +91,9 @@ Paper_book::output (SCM output_channel)
 {
   if (scm_is_pair (performances_))
     {
-      SCM proc = ly_lily_module_constant ("paper-book-write-midis");
-
-      scm_call_2 (proc, self_scm (), output_channel);
+      SCM proc = ly_lily_module_constant ("write-performances-midis");
+      scm_call_2 (proc, performances (), output_channel);
     }
 
   if (scores_ == SCM_EOL)
@@ -135,6 +136,13 @@ Paper_book::output (SCM output_channel)
 void
 Paper_book::classic_output (SCM output)
 {
+  if (scm_is_pair (performances_))
+    {
+      SCM proc = ly_lily_module_constant ("write-performances-midis");
+      scm_call_2 (proc, performances (), output);
+    }
+  
   /* Generate all stencils to trigger font loads.  */
   systems ();
 
@@ -236,14 +244,14 @@ set_system_penalty (SCM sys, SCM header)
            {
              vector<Grob*> cols = ps->get_columns ();
              if (cols.size ())
-               cols.back ()->set_property ("page-break-permission", sym);
+               {
+                 Paper_column *col = dynamic_cast<Paper_column*> (cols.back ());
+                 col->set_property ("page-break-permission", sym);
+                 col->find_prebroken_piece (LEFT)->set_property ("page-break-permission", sym);
+               }
            }
          else if (Prob *pb = unsmob_prob (sys))
-           {
-             pb->set_property ("page-break-permission", sym);
-             /* backwards compatibility for the old page breaker */
-             pb->set_property ("penalty", scm_from_int (b ? -10001 : 10001));
-           }
+           pb->set_property ("page-break-permission", sym);
        }
     }
 }
@@ -374,6 +382,7 @@ Paper_book::systems ()
   
   systems_ = scm_reverse (systems_);
 
+  /* backwards compatibility for the old page breaker */
   int i = 0;
   Prob *last = 0;
   for (SCM s = systems_; scm_is_pair (s); s = scm_cdr (s))
@@ -386,6 +395,16 @@ Paper_book::systems ()
          && !scm_is_number (ps->get_property ("penalty")))
        ps->set_property ("penalty", scm_from_int (10000));
       last = ps;
+
+      if (scm_is_pair (scm_cdr (s)))
+       {
+         SCM perm = ps->get_property ("page-break-permission");
+         Prob *next = unsmob_prob (scm_cadr (s));
+         if (perm == SCM_EOL)
+           next->set_property ("penalty", scm_from_int (10001));
+         else if (perm == ly_symbol2scm ("force"))
+           next->set_property ("penalty", scm_from_int (-10001));
+       }
     }
 
   return systems_;
@@ -399,7 +418,7 @@ Paper_book::pages ()
 
   pages_ = SCM_EOL;
   SCM proc = paper_->c_variable ("page-breaking-wrapper");
-  pages_ = scm_apply_0 (proc, scm_list_1(self_scm ()));
+  pages_ = scm_apply_0 (proc, scm_list_1 (self_scm ()));
 
   /* set systems_ from the pages */
   if (systems_ == SCM_BOOL_F)